コード例 #1
0
ファイル: RemoveProject.java プロジェクト: sgewuhan/cpm
  @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();
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  public void applyPreferences() {
    if (!hasChanges) {
      return;
    }
    hasChanges = false;
    // must do the store before setting the preference
    // to ensure that the store is flushed
    disableButton.store();

    List<String> elts = patternList.getElements();
    List<String> result = new ArrayList<String>(elts.size() * 2);
    for (String elt : elts) {
      result.add(elt);
      result.add(patternList.isChecked(elt) ? "y" : "n");
    }
    Activator.getDefault().setPreference(preferences, Activator.GROOVY_SCRIPT_FILTERS, result);

    boolean yesNo =
        MessageDialog.openQuestion(
            parent.getShell(),
            "Do full build?",
            "Script folder preferences have changed.\n"
                + "Must do a full build before they come completely into effect.  Do you want to do a full build now?");
    if (yesNo) {
      if (project != null) {
        new BuildJob(project).schedule();
      } else {
        new BuildJob(GroovyNature.getAllAccessibleGroovyProjects().toArray(new IProject[0]))
            .schedule();
      }
    }
  }
 /**
  * Disables the debugging if debug endpoint's type is changed to 'Internal', and if private port
  * is modified then assigns the new debugging port by setting the modified endpoint as a debugging
  * endpoint.
  *
  * @param oldType : old type of the endpoint.
  * @return retVal : false if any error occurs.
  * @throws WindowsAzureInvalidProjectOperationException
  */
 private boolean handleChangeForDebugEndpt(WindowsAzureEndpointType oldType)
     throws WindowsAzureInvalidProjectOperationException {
   boolean retVal = true;
   if (oldType.equals(WindowsAzureEndpointType.Input)
       && comboType.getText().equalsIgnoreCase(WindowsAzureEndpointType.Internal.toString())) {
     StringBuffer msg = new StringBuffer(Messages.dlgEPDel);
     msg.append(Messages.dlgEPChangeType);
     msg.append(Messages.dlgEPDel2);
     boolean choice =
         MessageDialog.openQuestion(new Shell(), Messages.dlgTypeTitle, msg.toString());
     if (choice) {
       waEndpt.setEndPointType(WindowsAzureEndpointType.valueOf(comboType.getText()));
       windowsAzureRole.setDebuggingEndpoint(null);
     } else {
       retVal = false;
     }
   } else if (!waEndpt.getPrivatePort().equalsIgnoreCase(txtPrivatePort.getText())) {
     boolean isSuspended = windowsAzureRole.getStartSuspended();
     windowsAzureRole.setDebuggingEndpoint(null);
     waEndpt.setPrivatePort(txtPrivatePort.getText());
     windowsAzureRole.setDebuggingEndpoint(waEndpt);
     windowsAzureRole.setStartSuspended(isSuspended);
   }
   return retVal;
 }
コード例 #4
0
 /** Listener for remove button, which removes the environment variable from the role. */
 @SuppressWarnings("unchecked")
 protected void removeBtnListener() {
   int selIndex = tblViewer.getTable().getSelectionIndex();
   if (selIndex > -1) {
     try {
       Entry<String, String> mapEntry =
           (Entry<String, String>) tblViewer.getTable().getItem(selIndex).getData();
       // Check environment variable is associated with component
       if (windowsAzureRole.getIsEnvPreconfigured(mapEntry.getKey())) {
         errorTitle = Messages.jdkDsblErrTtl;
         errorMessage = Messages.envJdkDslErrMsg;
         MessageUtil.displayErrorDialog(getShell(), errorTitle, errorMessage);
       } else {
         boolean choice =
             MessageDialog.openQuestion(new Shell(), Messages.evRemoveTtl, Messages.evRemoveMsg);
         if (choice) {
           // to delete call rename with newName(second param) as empty
           windowsAzureRole.renameRuntimeEnv(mapEntry.getKey(), "");
           tblViewer.refresh();
         }
       }
     } catch (Exception ex) {
       errorTitle = Messages.adRolErrTitle;
       errorMessage = Messages.adRolErrMsgBox1 + Messages.adRolErrMsgBox2;
       MessageUtil.displayErrorDialog(this.getShell(), errorTitle, errorMessage);
       Activator.getDefault().log(errorMessage, ex);
     }
   }
 }
コード例 #5
0
  public void doReload(ContentNode node, ContentVersion updated) throws Exception {
    if (updated
        .getMod()
        .equals(getInfoglueEditorInput().getContent().getContentVersion().getMod())) {
      System.out.println("This version seem to be up to date.");
      return;
    }

    if (!isDirty()
        || MessageDialog.openQuestion(
            PlatformUI.getWorkbench().getDisplay().getActiveShell(),
            "CMS Message",
            "The content "
                + getInfoglueEditorInput().getContent().getName()
                + " was changed remotely by user: "******". Do you want to reload the changed content?")) {
      // Only save the editors to remove dirty flag, not the editorinput (sent to cms)
      // TODO: ??????
      for (int i = 0; i < getPageCount(); i++) {
        getEditor(i).doSave(null);
      }

      IFolder tmp = ProjectHelper.getProject(node).getFolder("WebContent");
      setInput(InfoglueCMS.openContentVersion(node));

    } else if (isDirty()) {
      MessageDialog.openInformation(
          this.getActiveEditor().getSite().getShell(),
          "Unhandled situation",
          "The content was updated on the server, the local version is not the latest and synchronization/update feature is still not implemented. Your changes might not get saved to CMS");
    }
  }
コード例 #6
0
  /**
   * Should only be called if current object and model are not <code>null</code>.
   *
   * @since 5.5.3
   */
  private boolean openEditorIfNeeded(ModelResource currentModel) {
    boolean openEditorCancelled = false;
    // we only need to worry about the readonly status if the file is not currently open,
    // and its underlying IResource is not read only

    if (currentModel == null) {

    } else if (!isEditorOpen(currentModel)
        && !currentModel.getResource().getResourceAttributes().isReadOnly()) {
      final IFile modelFile = (IFile) currentModel.getResource();
      Shell shell = UiPlugin.getDefault().getCurrentWorkbenchWindow().getShell();

      // may want to change these text strings eventually:
      if (MessageDialog.openQuestion(
          shell, ModelEditorManager.OPEN_EDITOR_TITLE, ModelEditorManager.OPEN_EDITOR_MESSAGE)) {
        // load and activate, not async (to prevent multiple dialogs from coming up):
        // Changed to use method that insures Object editor mode is on
        ModelEditorManager.openInEditMode(
            modelFile, true, UiConstants.ObjectEditor.IGNORE_OPEN_EDITOR);

      } else {
        openEditorCancelled = true;
      }
    }

    return openEditorCancelled;
  }
コード例 #7
0
    /* (non-Javadoc)
     * @see java.lang.Runnable#run()
     */
    public void run() {

      // No token could be found, so create one

      String title = this.request.getRequester();
      if (title == null) {
        title = Messages.getString("UIAuthTokenProvider.req_token_title"); // $NON-NLS-1$
      }

      String message = this.request.getPurpose();
      if (message == null) {
        message = Messages.getString("UIAuthTokenProvider.new_token_question"); // $NON-NLS-1$
      }

      boolean result = MessageDialog.openQuestion(UIAuthTokenProvider.this.shell, title, message);

      if (result) {
        IAuthenticationTokenDescription description = this.request.getDescription();
        String tokenWizardId = description.getWizardId();
        if (showNewTokenWizard(tokenWizardId, false, description)) {
          this.token = this.cProvider.requestToken(this.request);
        } else {
          this.exc =
              new ProblemException(ICoreProblems.AUTH_TOKEN_REQUEST_CANCELED, Activator.PLUGIN_ID);
        }
      } else {
        this.exc =
            new ProblemException(ICoreProblems.AUTH_TOKEN_REQUEST_CANCELED, Activator.PLUGIN_ID);
      }
    }
コード例 #8
0
  /**
   * Leaves the currently running {@link SarosSession}<br>
   * Does nothing if no {@link SarosSession} is running.
   *
   * @param sarosSessionManager
   */
  public static void leaveSession(final SarosSessionManager sarosSessionManager) {
    ISarosSession sarosSession = sarosSessionManager.getSarosSession();

    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();

    if (sarosSession != null) {
      boolean reallyLeave;

      if (sarosSession.isHost()) {
        if (sarosSession.getParticipants().size() == 1) {
          // Do not ask when host is alone...
          reallyLeave = true;
        } else {
          reallyLeave =
              MessageDialog.openQuestion(
                  shell,
                  "Confirm Closing Session",
                  "Are you sure that you want to close this Saros session? Since you are the creator of this session, it will be closed for all participants.");
        }
      } else {
        reallyLeave =
            MessageDialog.openQuestion(
                shell,
                "Confirm Leaving Session",
                "Are you sure that you want to leave this Saros session?");
      }

      if (!reallyLeave) return;

      Utils.runSafeAsync(
          log,
          new Runnable() {
            public void run() {
              try {
                sarosSessionManager.stopSarosSession();
              } catch (Exception e) {
                log.error("Session could not be left: ", e);
              }
            }
          });
    } else {
      log.warn(
          "Tried to leave "
              + SarosSession.class.getSimpleName()
              + " although there is no one running");
    }
  }
コード例 #9
0
    @Override
    public void run() {

      boolean answer =
          MessageDialog.openQuestion(
              PrologConsoleView.this.getViewSite().getShell(),
              "Kill process",
              "Are you sure you want to kill the process? This will remove all breakpoints and will delete the list of consulted files");

      if (answer) {
        try {

          Job j =
              new UIJob("Stopping the PrologInterface") {

                @Override
                public IStatus runInUIThread(IProgressMonitor monitor) {
                  try {
                    monitor.beginTask("initializing...", IProgressMonitor.UNKNOWN);

                    PrologInterfaceRegistry registry =
                        PrologRuntimePlugin.getDefault().getPrologInterfaceRegistry();

                    PrologInterface oldPif = getPrologInterface();
                    if (oldPif != null) {
                      String currentKey = registry.getKey(oldPif);

                      oldPif.clearConsultedFiles();
                      oldPif.stop();

                      if ("true".equals(oldPif.getAttribute(KILLABLE))) {
                        Set<Subscription> subscriptionsForPif =
                            registry.getSubscriptionsForPif(currentKey);
                        for (Subscription s : subscriptionsForPif) {
                          registry.removeSubscription(s);
                        }
                        registry.removePrologInterface(currentKey);
                        getDefaultPrologConsoleService()
                            .fireConsoleVisibilityChanged(PrologConsoleView.this);
                        PrologRuntimeUIPlugin.getDefault()
                            .getPrologInterfaceService()
                            .setActivePrologInterface(null);
                      }
                    }
                  } catch (Throwable e) {
                    Debug.report(e);
                    return Status.CANCEL_STATUS;
                  } finally {
                    monitor.done();
                  }
                  return Status.OK_STATUS;
                }
              };
          j.schedule();
        } catch (Throwable t) {
          Debug.report(t);
        }
      }
    }
コード例 #10
0
  /**
   * Returns a commit comment specific to <code>task</code> and <code>resources</code>. If <code>
   * resources</code> is null or the associated projects do not specify a custom commit comment
   * template the global template is used.
   *
   * <p>This method must be invoked on the UI thread.
   *
   * @param checkTaskRepository if true, a warning dialog is displayed in case <code>task</code> is
   *     associated with a different repository than any of the <code>resources</code>
   * @param task the task to generate the commit comment for
   * @param resources that are being committed or null
   * @return a commit comment or an empty string if the user opted to abort generating the commit
   *     message
   * @since 3.5
   */
  public static String getComment(boolean checkTaskRepository, ITask task, IResource[] resources) {
    // lookup project specific template
    String template = null;
    Set<IProject> projects = new HashSet<IProject>();
    if (resources != null) {
      for (IResource resource : resources) {
        IProject project = resource.getProject();
        if (project != null && project.isAccessible() && !projects.contains(project)) {
          TeamPropertiesLinkProvider provider = new TeamPropertiesLinkProvider();
          template = provider.getCommitCommentTemplate(project);
          if (template != null) {
            break;
          }
          projects.add(project);
        }
      }
    }

    boolean proceed = true;

    // prompt if resources do not match task
    if (checkTaskRepository) {
      boolean unmatchedRepositoryFound = false;
      for (IProject project : projects) {
        TaskRepository repository = TasksUiPlugin.getDefault().getRepositoryForResource(project);
        if (repository != null) {
          if (!repository.getRepositoryUrl().equals(task.getRepositoryUrl())) {
            unmatchedRepositoryFound = true;
          }
        }
      }

      if (unmatchedRepositoryFound) {
        if (Display.getCurrent() != null) {
          proceed =
              MessageDialog.openQuestion(
                  WorkbenchUtil.getShell(),
                  Messages.ContextChangeSet_Mylyn_Change_Set_Management,
                  Messages.ContextChangeSet_ATTEMPTING_TO_COMMIT_RESOURCE);
        } else {
          proceed = false;
        }
      }
    }

    if (proceed) {
      if (template == null) {
        template =
            FocusedTeamUiPlugin.getDefault()
                .getPreferenceStore()
                .getString(FocusedTeamUiPlugin.COMMIT_TEMPLATE);
      }
      return FocusedTeamUiPlugin.getDefault()
          .getCommitTemplateManager()
          .generateComment(task, template);
    } else {
      return ""; //$NON-NLS-1$
    }
  }
コード例 #11
0
 private static boolean showConvertMessageBox(String fileName) {
   return MessageDialog.openQuestion(
       AndmoreAndroidPlugin.getDisplay().getActiveShell(),
       "Warning",
       String.format(
           "The file \"%s\" doesn't seem to be a 9-patch file. \n" + "Do you want to convert?",
           fileName));
 }
コード例 #12
0
  /**
   * Do the work after everything is specified.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  public boolean performFinish() {
    try {
      // Get the URI of the model file.
      //
      final URI fileURI = getModelURI();
      if (new File(fileURI.toFileString()).exists()) {
        if (!MessageDialog.openQuestion(
            getShell(),
            WorkaroundEditorPlugin.INSTANCE.getString("_UI_Question_title"),
            WorkaroundEditorPlugin.INSTANCE.getString(
                "_WARN_FileConflict", new String[] {fileURI.toFileString()}))) {
          initialObjectCreationPage.selectFileField();
          return false;
        }
      }

      // Do the work within an operation.
      //
      IRunnableWithProgress operation =
          new IRunnableWithProgress() {
            public void run(IProgressMonitor progressMonitor) {
              try {
                // Create a resource set
                //
                ResourceSet resourceSet = new ResourceSetImpl();

                // Create a resource for this file.
                //
                Resource resource = resourceSet.createResource(fileURI);

                // Add the initial model object to the contents.
                //
                EObject rootObject = createInitialModel();
                if (rootObject != null) {
                  resource.getContents().add(rootObject);
                }

                // Save the contents of the resource to the file system.
                //
                Map options = new HashMap();
                options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
                resource.save(options);
              } catch (Exception exception) {
                WorkaroundEditorPlugin.INSTANCE.log(exception);
              } finally {
                progressMonitor.done();
              }
            }
          };

      getContainer().run(false, false, operation);

      return WorkaroundEditorAdvisor.openEditor(workbench, fileURI);
    } catch (Exception exception) {
      WorkaroundEditorPlugin.INSTANCE.log(exception);
      return false;
    }
  }
  /**
   * {@inheritDoc}
   *
   * @see org.teiid.designer.ui.preferences.IGeneralPreferencePageContributor#performOk()
   */
  @Override
  public boolean performOk() {
    // persist value
    String versionString = versionCombo.getText();
    ITeiidServerVersion version = new TeiidServerVersion(versionString);

    if (versionString.equals(getPreferenceStoreValue(false))) return true; // same value - no change

    if (ModelerCore.getTeiidServerManager().getDefaultServer() == null && hasOpenEditors()) {
      // No default teiid instance and open editors so modelling diagrams may close which could
      // surprise!
      boolean changeVersion =
          MessageDialog.openQuestion(
              shell,
              Util.getStringOrKey(PREFIX + "versionChangeQuestionTitle"), // $NON-NLS-1$
              Util.getStringOrKey(PREFIX + "versionChangeQuestionMessage")); // $NON-NLS-1$

      if (!changeVersion) return false;
    }

    try {
      for (ITeiidServerVersion regVersion :
          TeiidRuntimeRegistry.getInstance().getSupportedVersions()) {
        if (regVersion.compareTo(version)) {
          getPreferenceStore().setValue(PREF_ID, regVersion.toString());
          return true;
        }
      }
    } catch (Exception ex) {
      Util.log(ex);
    }

    boolean changeVersion =
        MessageDialog.openQuestion(
            shell,
            Util.getStringOrKey(PREFIX + "unsupportedVersionQuestionTitle"), // $NON-NLS-1$
            Util.getStringOrKey(PREFIX + "unsupportedVersionQuestionMesssage")); // $NON-NLS-1$
    if (changeVersion) {
      getPreferenceStore().setValue(PREF_ID, version.toString());
      return true;
    }

    // No runtime client to support default version
    return false;
  }
コード例 #14
0
 private static Object promptUserZombieProcess(Object... data) {
   IWorkbenchWindow active = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
   Shell s = active.getShell();
   return MessageDialog.openQuestion(
       s,
       "Warning: server process not terminated",
       NLS.bind(
           "The process for server {0} has not been terminated. Would you like us to terminate it for you?",
           ((IServer) data[0]).getName()));
 }
コード例 #15
0
  @Override
  public boolean performCancel() {

    if (!enterXMPPAccountWizardPage.isXMPPAccountCreated()) return true;

    return MessageDialog.openQuestion(
        getShell(),
        Messages.AddXMPPAccountWizard_account_created,
        Messages.AddXMPPAccountWizard_account_created_text);
  }
コード例 #16
0
 private void showMessageDialogQuestion() {
   String title = "Question";
   String mesg =
       "Do you like the RAP technology?\n\n"
           + "Note that you can also press <Return> here. "
           + "The correct answer is automatically selected.";
   boolean result = MessageDialog.openQuestion(getShell(), title, mesg);
   messageDlgResLabel.setText("Result: " + result);
   messageDlgResLabel.pack();
 }
コード例 #17
0
 @Override
 protected boolean canHandleShellCloseEvent() {
   if (FileActionDialog.getDisablePopup()) {
     return true;
   }
   if (MessageDialog.openQuestion(
       getShell(), Messages.handleShellCloseEventTitle, Messages.handleShellCloseEventMessage)) {
     return super.canHandleShellCloseEvent();
   }
   return false;
 }
コード例 #18
0
  public void checkValidProjectTypes() {
    IProject[] projects = CoreUtil.getAllProjects();
    boolean hasValidProjectTypes = false;

    boolean hasJsfFacet = false;

    for (IProject project : projects) {
      if (ProjectUtil.isLiferayProject(project)) {
        Set<IProjectFacetVersion> facets =
            ProjectUtil.getFacetedProject(project).getProjectFacets();

        if (validProjectTypes != null && facets != null) {
          String[] validTypes = validProjectTypes.split(",");

          for (String validProjectType : validTypes) {
            for (IProjectFacetVersion facet : facets) {
              String id = facet.getProjectFacet().getId();

              if (isJsfPortlet && id.equals("jst.jsf")) {
                hasJsfFacet = true;
              }

              if (id.startsWith("liferay.") && id.equals("liferay." + validProjectType)) {
                hasValidProjectTypes = true;
              }
            }
          }
        }
      }
    }

    if (isJsfPortlet) {
      hasValidProjectTypes = hasJsfFacet && hasValidProjectTypes;
    }

    if (!hasValidProjectTypes) {
      final Shell activeShell = Display.getDefault().getActiveShell();
      Boolean openNewLiferayProjectWizard =
          MessageDialog.openQuestion(
              activeShell,
              "New Element",
              "There are no suitable Liferay projects available for this new element.\nDo you want"
                  + " to open the \'New Liferay Project\' wizard now?");

      if (openNewLiferayProjectWizard) {
        Action[] actions = NewPluginProjectDropDownAction.getNewProjectActions();

        if (actions.length > 0) {
          actions[0].run();
          this.checkValidProjectTypes();
        }
      }
    }
  }
コード例 #19
0
  /** @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) */
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    if (MessageDialog.openQuestion(
        HandlerUtil.getActiveShell(event),
        "Clear source schemas",
        "Do you really want to clear all source schemas?")) {
      SchemaService ss = (SchemaService) PlatformUI.getWorkbench().getService(SchemaService.class);
      ss.clearSchemas(SchemaSpaceID.SOURCE);
    }

    return null;
  }
コード例 #20
0
  /** @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) */
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    if (MessageDialog.openQuestion(
        HandlerUtil.getActiveShell(event),
        "Delete cells",
        "Do you really want to delete all cells?")) {
      AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
      as.clean();
    }

    return null;
  }
コード例 #21
0
  /**
   * If the preview preference is disabled or a Teiid server does not exist, a dialog is shown
   * asking the user if they want to enable preview and create a server.
   *
   * @param shell the shell used to display dialog if necessary
   * @return <code>true</code> if preview is enabled, a Teiid server exists, and a connection to the
   *     server has been made
   */
  public static boolean ensurePreviewEnabled(Shell shell) {
    boolean previewEnabled = isPreviewEnabled();
    boolean previewServerExists = previewServerExists();

    // dialog message (null if preview preference enabled and server exists)
    String msg = null;

    if (!previewEnabled && !previewServerExists) {
      msg = UTIL.getString(PREFIX + "previewDisabledNoTeiidInstanceMsg"); // $NON-NLS-1$
    } else if (!previewEnabled) {
      msg = UTIL.getString(PREFIX + "previewDisabledMsg"); // $NON-NLS-1$
    } else if (!previewServerExists) {
      msg = UTIL.getString(PREFIX + "noTeiidInstanceMsg"); // $NON-NLS-1$
    }

    // if necessary open question dialog
    if ((msg != null)
        && MessageDialog.openQuestion(
            shell, UTIL.getString(PREFIX + "confirmEnablePreviewTitle"), msg)) { // $NON-NLS-1$
      // if necessary change preference
      if (!previewEnabled) {
        IEclipsePreferences prefs = DqpPlugin.getInstance().getPreferences();
        prefs.putBoolean(PreferenceConstants.PREVIEW_ENABLED, true);

        // save
        try {
          prefs.flush();
        } catch (BackingStoreException e) {
          UTIL.log(e);
        }
      }

      // if necessary create new server
      if (!previewServerExists) {
        runNewServerAction(shell);
      }
    }

    // if dialog was shown get values again
    if (msg != null) {
      previewEnabled = isPreviewEnabled();
      previewServerExists = previewServerExists();

      // if preview is not enabled or server does not exist then user canceled the dialog or the new
      // server wizard
      if (!previewEnabled || !previewServerExists) {
        return false;
      }
    }

    // abort preview if server is not connected
    return serverConnectionExists(shell);
  }
  /** Add page to the wizard. */
  @Override
  public void addPages() {
    String sdkPath = null;
    if (Activator.IS_WINDOWS) {
      try {
        sdkPath = WindowsAzureProjectManager.getLatestAzureSdkDir();
      } catch (IOException e) {
        sdkPath = null;
        Activator.getDefault().log(errorMessage, e);
      }
    } else {
      Activator.getDefault().log("Not Windows OS, skipping getSDK");
    }
    try {
      if (sdkPath == null && Activator.IS_WINDOWS) {
        errorTitle = Messages.sdkInsErrTtl;
        errorMessage = Messages.sdkInsErrMsg;
        boolean choice = MessageDialog.openQuestion(getShell(), errorTitle, errorMessage);
        if (choice) {
          PlatformUI.getWorkbench()
              .getBrowserSupport()
              .getExternalBrowser()
              .openURL(new URL(Messages.sdkInsUrl));
        }
        addPage(null);
      } else {
        waProjWizPage = new WAProjectWizardPage(Messages.projWizPg);
        tabPg = new WATabPage(Messages.tbPg, waRole, this, true);
        /*
         * If wizard activated through right click on
         * Dynamic web project then
         * Add that as an WAR application.
         */
        if (Activator.getDefault().isContextMenu()) {
          IProject selProj = getSelectProject();
          tabPg.addToAppList(
              selProj.getLocation().toOSString(),
              selProj.getName() + ".war",
              WindowsAzureRoleComponentImportMethod.auto.name());
        }

        waKeyPage = new WAKeyFeaturesPage(Messages.keyPg);
        addPage(waProjWizPage);
        addPage(tabPg);
        addPage(waKeyPage);
      }
    } catch (Exception ex) {
      // only logging the error in log file not showing anything to
      // end user
      Activator.getDefault().log(errorMessage, ex);
    }
  }
コード例 #23
0
 /**
  * Opens the new project dialog if the workspace is empty.
  *
  * @param parent the parent shell
  * @return returns <code>true</code> when a project has been created, or <code>false</code> when
  *     the new project has been canceled.
  */
 protected boolean doCreateProjectFirstOnEmptyWorkspace(Shell parent) {
   IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
   if (workspaceRoot.getProjects().length == 0) {
     String title = DartUIMessages.OpenTypeAction_dialogTitle;
     String message = DartUIMessages.OpenTypeAction_createProjectFirst;
     if (MessageDialog.openQuestion(parent, title, message)) {
       new NewProjectAction().run();
       return workspaceRoot.getProjects().length != 0;
     }
     return false;
   }
   return true;
 }
コード例 #24
0
 public static void bowerLocationNotDefined() {
   boolean define =
       MessageDialog.openQuestion(
           Display.getDefault().getActiveShell(),
           Messages.BowerErrorHandler_BowerNotDefinedTitle,
           Messages.BowerErrorHandler_BowerNotDefinedMessage);
   if (define) {
     PreferenceDialog dialog =
         PreferencesUtil.createPreferenceDialogOn(
             Display.getDefault().getActiveShell(), BowerPreferencePage.PAGE_ID, null, null);
     dialog.open();
   }
 }
コード例 #25
0
 /**
  * Opens the new project dialog if the workspace is empty. This method is called on {@link
  * #run()}.
  *
  * @param shell the shell to use
  * @return returns <code>true</code> when a project has been created, or <code>false</code> when
  *     the new project has been canceled.
  */
 protected boolean doCreateProjectFirstOnEmptyWorkspace(Shell shell) {
   IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
   if (workspaceRoot.getProjects().length == 0) {
     String title = NewWizardMessages.AbstractOpenWizardAction_noproject_title;
     String message = NewWizardMessages.AbstractOpenWizardAction_noproject_message;
     if (MessageDialog.openQuestion(shell, title, message)) {
       new NewProjectAction().run();
       return workspaceRoot.getProjects().length != 0;
     }
     return false;
   }
   return true;
 }
コード例 #26
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();
    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;
    }
  }
コード例 #27
0
 private boolean getPropagate(Boolean returnIfNull) {
   if (propagate == null) {
     if (returnIfNull != null) {
       return returnIfNull;
     }
     propagate =
         MessageDialog.openQuestion(
             new Shell(),
             Messages.getString("ChangeMetadataCommand.messageDialog.propagate"), // $NON-NLS-1$
             Messages.getString(
                 "ChangeMetadataCommand.messageDialog.questionMessage")); //$NON-NLS-1$
   }
   return propagate;
 }
コード例 #28
0
  public static boolean promptConfirmLauch(Shell shell, IContext context, IProcess process) {
    boolean continueLaunch = true;

    int nbValues = 0;
    if (context == null) {
      throw new IllegalArgumentException("Context is null"); // $NON-NLS-1$
    }
    // Prompt for context values ?
    for (IContextParameter parameter : context.getContextParameterList()) {
      if (parameter.isPromptNeeded()) {
        nbValues++;
      }
    }
    if (nbValues > 0) {
      IContext contextCopy = context.clone();
      PromptDialog promptDialog = new PromptDialog(shell, contextCopy);
      if (promptDialog.open() == PromptDialog.OK) {
        for (IContextParameter param : context.getContextParameterList()) {
          boolean found = false;
          IContextParameter paramCopy = null;
          for (int i = 0; i < contextCopy.getContextParameterList().size() & !found; i++) {
            paramCopy = contextCopy.getContextParameterList().get(i);
            if (param.getName().equals(paramCopy.getName())) {
              // param.setValueList(paramCopy.getValueList());
              param.setInternalValue(paramCopy.getValue());
              found = true;
            }
          }
        }
        contextComboViewer.refresh();
        contextTableViewer.refresh();
        processNeedGenCode(process);
      } else {
        continueLaunch = false;
      }
    } else {
      if (context.isConfirmationNeeded()) {
        continueLaunch =
            MessageDialog.openQuestion(
                shell,
                Messages.getString("ProcessComposite.confirmTitle"), // $NON-NLS-1$
                Messages.getString(
                    "ProcessComposite.confirmText", context.getName())); // $NON-NLS-1$
      }

      updateDefaultValueForListTypeParameter(context.getContextParameterList());
    }
    return continueLaunch;
  }
コード例 #29
0
  public void runDeleteAction() {
    RosterEntry rosterEntry = null;
    List<RosterEntry> selectedRosterEntries =
        SelectionRetrieverFactory.getSelectionRetriever(RosterEntry.class).getSelection();
    if (selectedRosterEntries.size() == 1) {
      rosterEntry = selectedRosterEntries.get(0);
    }

    if (rosterEntry == null) {
      LOG.error("RosterEntry should not be null at this point!"); // $NON-NLS-1$
      return;
    }

    if (sessionManager != null) {
      // Is the chosen user currently in the session?
      ISarosSession sarosSession = sessionManager.getSarosSession();
      String entryJid = rosterEntry.getUser();

      if (sarosSession != null) {
        for (User p : sarosSession.getUsers()) {
          String pJid = p.getJID().getBase();

          // If so, stop the deletion from completing
          if (entryJid.equals(pJid)) {
            MessageDialog.openError(
                null, Messages.DeleteContactAction_error_title, DELETE_ERROR_IN_SESSION);
            return;
          }
        }
      }
    }

    if (MessageDialog.openQuestion(
        null,
        Messages.DeleteContactAction_confirm_title,
        MessageFormat.format(
            Messages.DeleteContactAction_confirm_message, toString(rosterEntry)))) {

      try {
        XMPPUtils.removeFromRoster(connectionService.getConnection(), rosterEntry);
      } catch (XMPPException e) {
        LOG.error(
            "could not delete contact "
                + toString(rosterEntry) // $NON-NLS-1$
                + ":",
            e); //$NON-NLS-1$
      }
    }
  }
コード例 #30
0
  private void savePubspecFile(IContainer container) {
    IResource resource = container.findMember(DartCore.PUBSPEC_FILE_NAME);
    if (resource != null) {
      IEditorPart editor = EditorUtility.isOpenInEditor(resource);
      if (editor != null && editor.isDirty()) {
        if (MessageDialog.openQuestion(
            getShell(),
            NLS.bind(ActionMessages.RunPubAction_commandText, command),
            ActionMessages.RunPubAction_savePubspecMessage)) {

          editor.doSave(new NullProgressMonitor());
        }
      }
    }
  }