/**
  * Opens dialog based on the resource selected
  *
  * @param resource
  * @param window
  */
 private void openDialogBasedOnResourceSelected(IResource resource, IWorkbenchWindow window) {
   WizardDialog dialog = null;
   if (resource != null) {
     // in case there is a resource, go on
     if (resource instanceof IFile) {
       // get wizard for database file
       dialog =
           new WizardDialog(
               window.getShell(),
               new DatabaseManagementClassesCreationWizard(resource.getProject(), resource));
     } else {
       // get wizard with no database file
       dialog =
           new WizardDialog(
               window.getShell(),
               new DatabaseManagementClassesCreationWizard(resource.getProject(), null));
     }
   } else {
     // resource is null, set the wizard with nothing selected
     dialog =
         new WizardDialog(
             window.getShell(), new DatabaseManagementClassesCreationWizard(null, null));
   }
   if (dialog != null) {
     // open the wizard
     dialog.open();
   }
 }
Example #2
0
  @Override
  public void run(IAction action) {
    if (project == null) {
      return;
    }
    // 不是初始化的项目不能删除
    DBObject projectData = project.getData();
    if (!DataUtil.isInactive(projectData) && !DataUtil.isInactive(projectData)) {
      MessageDialog.openWarning(
          window.getShell(),
          UIConstants.TEXT_REMOVE_PROJECT,
          UIConstants.MESSAGE_CANNOT_DELETE_PROJECT_NOT_INIT_OR_READY);
      return;
    }

    // 项目管理员和项目创建者可以删除
    if (!DataUtil.isProjectCreator(projectData) && !DataUtil.isProjectAdmin(projectData)) {
      MessageDialog.openWarning(
          window.getShell(),
          UIConstants.TEXT_REMOVE_PROJECT,
          UIConstants.MESSAGE_CANNOT_DELETE_PROJECT_NOT_AUTH);
      return;
    }

    boolean ok =
        MessageDialog.openQuestion(
            window.getShell(),
            UIConstants.TEXT_REMOVE_PROJECT,
            ""
                + project.getText(IDBConstants.FIELD_DESC)
                + UIConstants.MESSAGE_QUESTION_REMOVE_PROJECT);
    if (!ok) return;
    removeUserInformation();
    project.remove();
  }
Example #3
0
  /**
   * ************************************************************************* The command has been
   * executed, so extract extract the needed information from the application context.
   * ************************************************************************
   */
  public CommandResult execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

    IServerProxy proxy = (IServerProxy) ServiceManager.get(IServerProxy.class);
    ServerRole role = proxy.getCurrentServer().getRole();
    if (role != ServerRole.COMMANDING) {
      MessageDialog.openError(
          window.getShell(),
          "Cannot open",
          "Cannot schedule procedures on the current server,\n" + "the role is monitoring");
      return CommandResult.NO_EFFECT;
    }

    IRuntimeSettings runtime = (IRuntimeSettings) ServiceManager.get(IRuntimeSettings.class);
    String procId =
        (String) runtime.getRuntimeProperty(RuntimeProperty.ID_NAVIGATION_VIEW_SELECTION);
    if (procId != null) {
      ConditionDialog dlg = new ConditionDialog(window.getShell());
      dlg.open();
      String condition = dlg.getCondition();
      if (condition != null) {
        ScheduleProcedureJob job = new ScheduleProcedureJob(procId, condition);
        CommandHelper.executeInProgress(job, true, true);
        if (job.result != CommandResult.SUCCESS) {
          MessageDialog.openError(window.getShell(), "Schedule error", job.message);
        }
        return job.result;
      } else {
        return CommandResult.NO_EFFECT;
      }
    } else {
      return CommandResult.NO_EFFECT;
    }
  }
 /** @generated */
 private static boolean openEditor(IWorkbench workbench, URI fileURI) {
   IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
   IWorkbenchPage page = workbenchWindow.getActivePage();
   IEditorDescriptor editorDescriptor =
       workbench.getEditorRegistry().getDefaultEditor(fileURI.toFileString());
   if (editorDescriptor == null) {
     MessageDialog.openError(
         workbenchWindow.getShell(),
         Messages.DiagramEditorActionBarAdvisor_DefaultFileEditorTitle,
         NLS.bind(
             Messages.DiagramEditorActionBarAdvisor_DefaultFileEditorMessage,
             fileURI.toFileString()));
     return false;
   } else {
     try {
       page.openEditor(new URIEditorInput(fileURI), editorDescriptor.getId());
     } catch (PartInitException exception) {
       MessageDialog.openError(
           workbenchWindow.getShell(),
           Messages.DiagramEditorActionBarAdvisor_DefaultEditorOpenErrorTitle,
           exception.getMessage());
       return false;
     }
   }
   return true;
 }
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    FileDialog dialog = new FileDialog(workbenchWindow.getShell(), SWT.OPEN);
    dialog.setFilterExtensions(new String[] {"*.xlsx", "*.xls"});
    dialog.setText("Select the Excel file to upload");
    final String filePath = dialog.open();
    final String fileName = dialog.getFileName();

    if (filePath != null) {
      ImportWindow importWindow = new ImportWindow();
      String importMode = importWindow.open();

      if (importMode != null) {
        MenuCommand cmd =
            new MenuCommand() {
              @Override
              public void execute(IProject project, IFile file) throws Exception {
                importExcelAndGenerateFiles(project, filePath, fileName, importMode);
              }
            };
        MenuCommandWindow window =
            new MenuCommandWindow(workbenchWindow.getShell(), cmd, true, null);
        window.open();
      }
    }
    return null;
  }
Example #6
0
  /**
   * the command has been executed, so extract extract the needed information from the application
   * context.
   */
  public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    ITextSelection content =
        (ITextSelection)
            window
                .getActivePage()
                .getActiveEditor()
                .getEditorSite()
                .getSelectionProvider()
                .getSelection();
    String texto = content.getText();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Clipboard clipboard = toolkit.getSystemClipboard();

    String sqlFormatado = formatSQL(texto);

    StringSelection textoFormatado = new StringSelection(sqlFormatado);
    clipboard.setContents(textoFormatado, null);

    if (isBlank(texto)) {
      MessageDialog.openInformation(window.getShell(), "SQLCopy", "Você não selecionou nada!");
    } else {
      if (isConvertToJava(
          texto)) { // Realizar a substituição do texto selecionado apenas quando estiver
        // convertendo um SQL para Java.
        IEditorPart part =
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        ITextEditor editor = (ITextEditor) part;
        IDocumentProvider prov = editor.getDocumentProvider();
        IDocument doc = prov.getDocument(editor.getEditorInput());
        ISelection sel = editor.getSelectionProvider().getSelection();

        if (sel instanceof TextSelection) {
          final TextSelection textSel = (TextSelection) sel;
          try {
            //		            	IRegion region = doc.getLineInformationOfOffset(textSel.getOffset());
            //						doc.replace( textSel.getOffset(), textSel.getLength(),
            // identingCode(region.getLength(), sqlFormatado));
            doc.replace(textSel.getOffset(), textSel.getLength(), sqlFormatado);
          } catch (BadLocationException e) {
            e.printStackTrace();
          }
        }
      }
      //			MessageDialog.openInformation(
      //					window.getShell(),
      //					"SQLCopy",
      //					sqlFormatado.toString());
      CustomMessageDialog dialog =
          new CustomMessageDialog(window.getShell(), sqlFormatado.toString());
      dialog.open();
    }

    return null;
  }
  /** Creates a dialog that'll choose from a list of interpreter infos. */
  public static SelectionDialog createChooseIntepreterInfoDialog(
      IWorkbenchWindow workbenchWindow,
      IInterpreterInfo[] interpreters,
      String msg,
      boolean selectMultiple) {

    IStructuredContentProvider contentProvider =
        new IStructuredContentProvider() {

          public Object[] getElements(Object inputElement) {
            if (inputElement instanceof IInterpreterInfo[]) {
              return (IInterpreterInfo[]) inputElement;
            }
            return new Object[0];
          }

          public void dispose() {}

          public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
        };

    LabelProvider labelProvider =
        new LabelProvider() {
          public Image getImage(Object element) {
            return PydevPlugin.getImageCache().get(UIConstants.PY_INTERPRETER_ICON);
          }

          public String getText(Object element) {
            if (element != null && element instanceof IInterpreterInfo) {
              IInterpreterInfo info = (IInterpreterInfo) element;
              return info.getNameForUI();
            }
            return super.getText(element);
          }
        };

    SelectionDialog selectionDialog;
    if (selectMultiple) {
      selectionDialog =
          new ListSelectionDialog(
              workbenchWindow.getShell(), interpreters, contentProvider, labelProvider, msg);
    } else {

      ListDialog listDialog = new ListDialog(workbenchWindow.getShell());

      listDialog.setContentProvider(contentProvider);
      listDialog.setLabelProvider(labelProvider);
      listDialog.setInput(interpreters);
      listDialog.setMessage(msg);
      selectionDialog = listDialog;
    }
    return selectionDialog;
  }
  /**
   * ************************************************************************* The command has been
   * executed, so extract extract the needed information from the application context.
   * ************************************************************************
   */
  public CommandResult execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IRuntimeSettings runtime = (IRuntimeSettings) ServiceManager.get(IRuntimeSettings.class);
    String instanceId = (String) runtime.getRuntimeProperty(RuntimeProperty.ID_PROCEDURE_SELECTION);

    try {
      IProcedureManager mgr = (IProcedureManager) ServiceManager.get(IProcedureManager.class);
      IProcedure proc = null;
      if (mgr.isLocallyLoaded(instanceId)) {
        proc = mgr.getProcedure(instanceId);
      } else {
        proc = mgr.getRemoteProcedure(instanceId);
      }

      List<AsRunFile> toExport = new LinkedList<AsRunFile>();

      ExportAsRunFileJob job = new ExportAsRunFileJob(proc);
      CommandHelper.executeInProgress(job, true, true);

      if (job.result.equals(CommandResult.SUCCESS)) {
        toExport.add(job.asrunFile);
        if (!job.asrunFile.getChildren().isEmpty()) {
          boolean alsoChildren =
              MessageDialog.openQuestion(
                  window.getShell(),
                  "Export children ASRUN files",
                  "This procedure has executed sub-procedures.\n\nDo you want to export these ASRUN files as well?");
          if (alsoChildren) {
            gatherChildAsRunFiles(job.asrunFile, toExport);
          }
        }
      }

      DirectoryDialog dialog = new DirectoryDialog(window.getShell(), SWT.SAVE);
      dialog.setMessage(
          "Select directory to export ASRUN file(s) for '" + proc.getProcName() + "'");
      dialog.setText("Export ASRUN");
      String destination = dialog.open();
      if (destination != null && !destination.isEmpty()) {
        SaveAsRunFileJob saveJob = new SaveAsRunFileJob(destination, toExport);
        CommandHelper.executeInProgress(saveJob, true, true);
        return saveJob.result;
      } else {
        return CommandResult.NO_EFFECT;
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      return CommandResult.FAILED;
    }
  }
Example #9
0
  /**
   * The action has been activated. The argument of the method represents the 'real' action sitting
   * in the workbench UI.
   *
   * @see IWorkbenchWindowActionDelegate#run
   */
  public void run(IAction action) {
    ProjectNameDialog dialog = new ProjectNameDialog(window.getShell());
    try {
      String projectName = dialog.getProjectName();
      CriticPlugin.startAnalysis(projectName);
    } catch (Exception e) {
      MessageDialog.openError(window.getShell(), "Error Processing", e.getMessage());
      return;
    }

    //		MessageDialog.openInformation(
    //			window.getShell(),
    //			"Critical",
    //			"Hello, Eclipse world");
  }
  @SuppressWarnings("unused")
  public Object execute(ExecutionEvent event) throws ExecutionException {
    final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
    if (window == null) {
      return null;
    }
    final IContextService service = (IContextService) window.getService(IContextService.class);
    Shell shell = new Shell(window.getShell().getDisplay());
    service.registerShell(shell, IContextService.TYPE_WINDOW);
    // Shell shell = new Shell(window.getShell());
    shell.setLayout(new FillLayout());
    Button b = new Button(shell, SWT.PUSH);
    final Text text = new Text(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    b.setText(Messages.showContexts_button);
    b.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {

            Object[] array = service.getActiveContextIds().toArray();
            Arrays.sort(array);
            StringBuffer buf = new StringBuffer(Messages.showContexts_title);
            for (int i = 0; i < array.length; i++) {
              buf.append('\n');
              buf.append(array[i].toString());
            }
            text.setText(buf.toString());
          }
        });
    shell.setSize(400, 300);
    shell.layout();
    shell.open();
    return null;
  }
Example #11
0
  /**
   * The action has been activated. The argument of the method represents the 'real' action sitting
   * in the workbench UI.
   *
   * @see IWorkbenchWindowActionDelegate#run
   */
  public void run(IAction action) {
    AlisaEditor editor;
    Requirement requirement;

    requirement = null;
    editor = null;
    IEditorPart editorPart = window.getActivePage().getActiveEditor();

    if (editorPart instanceof AlisaEditor) {
      editor = (AlisaEditor) editorPart;
    }

    if (editor != null) {
      Object o =
          ((IStructuredSelection)
                  (editor.getTableViewer(AlisaEditor.INDEX_TABLE_REQUIREMENTS).getSelection()))
              .getFirstElement();
      if (o instanceof Requirement) {
        requirement = (Requirement) o;
      }
    }

    if (requirement == null) {
      MessageBox dialog = new MessageBox(window.getShell(), SWT.OK);
      dialog.setText("Alisa CAE Generator");
      dialog.setMessage("You must select a requirement");
      dialog.open();
    } else {
      //			GeneratorCAE.init();
      //			GeneratorCAE.generate (null, requirement);
      //			GeneratorCAE.save(edu.cmu.sei.alisa.analysis.utils.Utils.getSelectedProject());
      //			AlisaDebug.debug("[GenerateCAE] selected requirement=" + requirement);
    }
  }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
   */
  public void run(IAction action) {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    Shell shell = window.getShell();

    // confirm before copying from base-class
    if (!confirmSynchronization(shell)) {
      return;
    }

    mmlEditorStateManager.closeEditors();

    WorkspaceModifyOperation operation =
        new WorkspaceModifyOperation() {
          public void execute(IProgressMonitor monitor) throws CoreException {
            Object obj = selection.getFirstElement();
            if (obj instanceof IOfsElement) {
              new DatasetFacility().synchronizeDatasets(monitor, (IOfsElement) obj);
            }
          }
        };

    try {
      new ProgressMonitorDialog(shell).run(true, false, operation);
    } catch (Exception e) {
      OfsUICore.getDefault().logError("Error Validating Domain Models", e);
    }
    mmlEditorStateManager.restoreEditors();
  }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
   * .ExecutionEvent)
   */
  public Object execute(ExecutionEvent event) throws ExecutionException {

    LoadModelInstanceWizard wizard;
    WizardDialog dialog;

    ISelection currentSelection;
    IStructuredSelection currentStructuredSelection;

    /* Get the current selection. */
    IWorkbenchWindow window =
        ModelBusUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
    currentSelection = window.getSelectionService().getSelection();

    if (currentSelection instanceof IStructuredSelection) {
      currentStructuredSelection = (IStructuredSelection) currentSelection;
    } else {
      currentStructuredSelection = null;
    }

    /* Initialize and start the depending code gen wizard. */
    wizard = new LoadModelInstanceWizard();
    wizard.init(window.getWorkbench(), currentStructuredSelection);

    /* Instantiates the wizard container with the wizard and opens it. */
    dialog = new WizardDialog(window.getShell(), wizard);
    dialog.create();
    dialog.open();

    return null;
  }
  /**
   * Adds this as element state listener in the UI thread as it can otherwise conflict with other
   * listener additions, since DocumentProvider is not thread-safe.
   *
   * @param editor the editor to get the display from
   * @param provider the document provider to register as element state listener
   */
  private void addElementStateListener(ITextEditor editor, final IDocumentProvider provider) {
    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=66686 and
    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56871

    Runnable runnable =
        new Runnable() {
          public void run() {
            synchronized (fLock) {
              if (fDocumentProvider == provider)
                // addElementStateListener adds at most once - no problem to call repeatedly
                provider.addElementStateListener(LastSaveReferenceProvider.this);
            }
          }
        };

    Display display = null;
    if (editor != null) {
      IWorkbenchPartSite site = editor.getSite();
      if (site != null) {
        IWorkbenchWindow window = site.getWorkbenchWindow();
        if (window != null) {
          Shell shell = window.getShell();
          if (shell != null) display = shell.getDisplay();
        }
      }
    }

    if (display != null && !display.isDisposed()) {
      display.asyncExec(runnable);
    } else {
      runnable.run();
    }
  }
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
    IWorkbenchPage page = window.getActivePage();
    View view = (View) page.findView(View.ID);
    view.getViewer().refresh();

    // open dialog to get path
    FileDialog filedlg = new FileDialog(window.getShell(), SWT.SAVE);
    filedlg.setText("Create Sequence Diagram File");
    filedlg.setFilterPath("SystemRoot");
    filedlg.setFilterExtensions(new String[] {"di"});
    String selected = filedlg.open();

    // create & initial the sequence diagram
    MyCreater myCreater = new MyCreater();
    myCreater.init(window.getWorkbench(), new StructuredSelection()); // fixed bug
    IFile iFile = myCreater.create(selected);

    // create the model
    SequenceDiagram sdDiagram = new SequenceDiagram();
    sdDiagram.setiFile(iFile);
    sdDiagram.setFilePath(
        new Path(selected).removeFileExtension().addFileExtension("uml").toOSString());
    ModelManager.getInstance().AddModel(sdDiagram);

    // open the editor
    myCreater.open(iFile);

    // refresh the model viewer
    view.getViewer().refresh();

    return null;
  }
  public ManageLaunchesDialog(IWorkbenchWindow window) {
    super(window.getShell());

    this.window = window;

    setShellStyle(getShellStyle() | SWT.RESIZE);
  }
  public void run() {
    NewPHPClassWizard wizard = new NewPHPClassWizard();
    wizard.init(window.getWorkbench(), getSelection());

    WizardDialog wizardDialog = new WizardDialog(window.getShell(), wizard);
    wizardDialog.open();
  }
  /**
   * Attempts to return the default shell. If it cannot return the default shell, it returns the
   * shell of the first workbench window that has shell.
   *
   * @return The shell
   * @since 1.2
   */
  public static Shell getDefaultShell() {
    Shell shell = null;

    try {
      shell = Display.getDefault().getActiveShell();
    } catch (Exception e) {
      // ignore
    }

    try {
      if (shell == null) {
        if (!PlatformUI.isWorkbenchRunning()) {
          return new Shell();
        }
        IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (activeWindow != null) {
          shell = activeWindow.getShell();
        }
      }
    } catch (Exception e) {
      // ignore
    }

    if (shell == null) {
      if (!PlatformUI.isWorkbenchRunning()) {
        return new Shell();
      }
      IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
      for (int i = 0; shell == null && i < windows.length; i++) {
        shell = windows[i].getShell();
      }
    }

    return shell;
  }
Example #19
0
 public static Shell getActiveWorkbenchShell() {
   IWorkbenchWindow window = getActiveWorkbenchWindow();
   if (window != null) {
     return window.getShell();
   }
   return null;
 }
  public void testExtensionContributionExpression() throws Exception {
    IAction a =
        new Action() {
          @Override
          public void run() {
            System.out.println("Hello action");
          }
        };
    final MenuManager manager = new MenuManager();
    final ActionContributionItem aci = new ActionContributionItem(a);

    IExtensionRegistry reg = Platform.getExtensionRegistry();
    IExtensionPoint menusExtension = reg.getExtensionPoint("org.eclipse.ui.menus");
    IExtension extension = menusExtension.getExtension(EXTENSION_ID);

    IConfigurationElement[] mas = extension.getConfigurationElements();
    final Expression activeContextExpr[] = new Expression[1];
    for (IConfigurationElement ma : mas) {
      IConfigurationElement[] items = ma.getChildren();
      for (IConfigurationElement item : items) {
        String id = item.getAttribute("id");
        if (id != null && id.equals("org.eclipse.ui.tests.menus.itemX1")) {
          IConfigurationElement visibleWhenElement = item.getChildren("visibleWhen")[0];
          activeContextExpr[0] =
              ExpressionConverter.getDefault().perform(visibleWhenElement.getChildren()[0]);
        }
      }
    }
    assertNotNull("Failed to find expression", activeContextExpr[0]);
    AbstractContributionFactory factory =
        new AbstractContributionFactory(LOCATION, TestPlugin.PLUGIN_ID) {
          @Override
          public void createContributionItems(
              IServiceLocator menuService, IContributionRoot additions) {
            additions.addContributionItem(aci, activeContextExpr[0]);
          }
        };

    menuService.addContributionFactory(factory);
    menuService.populateContributionManager(manager, LOCATION);

    assertFalse("starting state", aci.isVisible());

    activeContext = contextService.activateContext(MenuContributionHarness.CONTEXT_TEST1_ID);
    final Menu menu = manager.createContextMenu(window.getShell());
    menu.notifyListeners(SWT.Show, new Event());
    assertTrue("active context", aci.isVisible());
    menu.notifyListeners(SWT.Hide, new Event());

    contextService.deactivateContext(activeContext);
    activeContext = null;

    menu.notifyListeners(SWT.Show, new Event());
    assertFalse("after deactivation", aci.isVisible());
    menu.notifyListeners(SWT.Hide, new Event());

    menuService.releaseContributions(manager);
    menuService.removeContributionFactory(factory);
    manager.dispose();
  }
  public void postWindowOpen() {

    if (UnwCorePlugin.useBatchMode) {
      window = getWindowConfigurer().getWindow();
      window.getShell().setMinimized(true);
    }

    actionBarConfigurer = getWindowConfigurer().getActionBarConfigurer();
    myMenuBar = actionBarConfigurer.getMenuManager();

    ViewUtils.setStatusLineManager(actionBarConfigurer.getStatusLineManager());

    imageSsght = UnwGUIPlugin.getImageDescriptor("icons/eye2_32.png").createImage();
    getWindowConfigurer().getWindow().getShell().setImage(imageSsght);

    // register into the CoreManager the reference to the status line
    saveStatusLine();

    // remove foreign menu items
    cleanMenuBar();

    // remove foreign buttons in the tool bar
    cleanToolBar();

    UnwInfrastructure.postWindowOpen();
  }
 protected Shell getShell() {
   IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
   if (window != null) {
     return window.getShell();
   }
   return null;
 }
Example #23
0
  /** @return either Window.OK or Window.CANCEL */
  private int showPreferenceDialog() {
    FilteredPreferenceDialog dialog =
        WorkbenchPreferenceDialog.createDialogOn(window.getShell(), DebugPreferencePage.PAGE_ID);

    dialog.showOnly(new String[] {DebugPreferencePage.PAGE_ID});

    return dialog.open();
  }
  /**
   * The action has been activated. The argument of the method represents the 'real' action sitting
   * in the workbench UI.
   *
   * @see IWorkbenchWindowActionDelegate#run
   */
  public void run(IAction action) {

    DVDStylerExportWizard wizard = new DVDStylerExportWizard();

    WizardDialog dialog = new WizardDialog(window.getShell(), wizard);

    dialog.open();
  }
 public void execute() {
   IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
   if (window != null) {
     WorkbenchPreferenceDialog dialog =
         WorkbenchPreferenceDialog.createDialogOn(window.getShell(), preferenceNode.getId());
     dialog.open();
   }
 }
Example #26
0
 /**
  * @see
  *     org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
  */
 public Object execute(final ExecutionEvent executionEvent) throws ExecutionException {
   final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(executionEvent);
   final NewTriggerWizard wizard = new NewTriggerWizard();
   wizard.init(window.getWorkbench(), StructuredSelection.EMPTY);
   final WizardDialog wizardDialog = new STEMWizardDialog(window.getShell(), wizard);
   wizardDialog.open();
   return null;
 } // execute
 /* (non-Javadoc)
  * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
  */
 @Override
 public void run(IAction action) {
   if (EngineDriver.getRunningInstance() != null) {
     EngineDriver.getRunningInstance().resume();
   } else
     MessageDialog.openWarning(
         window.getShell(), "CoreASM Plug-in", "No engine is running." + action);
 }
 protected Shell getShell() {
   if (fPart != null) {
     return fPart.getSite().getShell();
   } else if (fWindow != null) {
     return fWindow.getShell();
   }
   return AutotoolsPlugin.getActiveWorkbenchShell();
 }
 @Override
 protected Object execute(ExecutionEvent event, ContextHandlerEvent contextEvent)
     throws ExecutionException {
   IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
   AbstractWizard wizard = createWizard(event, contextEvent);
   WizardDialog dlg = new WizardDialog(window.getShell(), wizard);
   dlg.open();
   return null;
 }
 /**
  * the command has been executed, so extract extract the needed information from the application
  * context.
  */
 @Override
 public Object execute(ExecutionEvent event) throws ExecutionException {
   IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
   MessageDialog.openInformation(
       window.getShell(),
       ContributionMessages.SampleHandler_plugin_name,
       ContributionMessages.SampleHandler_hello_msg);
   return null;
 }