private Map promptForOverwrite(List plugins, List locales) {
    Map overwrites = new HashMap();

    if (overwriteWithoutAsking) return overwrites;

    for (Iterator iter = plugins.iterator(); iter.hasNext(); ) {
      IPluginModelBase plugin = (IPluginModelBase) iter.next();
      for (Iterator it = locales.iterator(); it.hasNext(); ) {
        Locale locale = (Locale) it.next();
        IProject project = getNLProject(plugin, locale);

        if (project.exists() && !overwrites.containsKey(project.getName())) {
          boolean overwrite =
              MessageDialog.openConfirm(
                  PDEPlugin.getActiveWorkbenchShell(),
                  PDEUIMessages.InternationalizeWizard_NLSFragmentGenerator_overwriteTitle,
                  NLS.bind(
                      PDEUIMessages.InternationalizeWizard_NLSFragmentGenerator_overwriteMessage,
                      pluginName(plugin, locale)));
          overwrites.put(project.getName(), overwrite ? OVERWRITE : null);
        }
      }
    }

    return overwrites;
  }
  private void onSelectDelete(final Object selectedPart) {

    if (selectedPart instanceof PartMP) {

      final MP selectedPartMp = ((PartMP) selectedPart).partMp;

      if (MessageDialog.openConfirm(
          _display.getActiveShell(),
          Messages.Dialog_OfflineArea_ConfirmDelete_Title,
          NLS.bind(
              Messages.Dialog_OfflineArea_ConfirmDeletePart_Message, selectedPartMp.getName()))) {

        deleteOfflineImages(selectedPartMp);
      }

    } else {

      if (MessageDialog.openConfirm(
          _display.getActiveShell(),
          Messages.Dialog_OfflineArea_ConfirmDelete_Title,
          Messages.Dialog_OfflineArea_ConfirmDeleteAll_Message)) {

        deleteOfflineImages(null);
      }
    }
  }
 private void handleSetDefaultButton() {
   try {
     CustomizeData custData = getCustTableSelection();
     if (custData.getName().equals(CustomizeManager.TABLE_DEFAULT_LABEL)
         || custData.getName().equals(CustomizeManager.CURRENT_LABEL)) {
       XViewerLib.popup("ERROR", XViewerText.get("error.set_default"));
       return;
     }
     if (xViewerToCustomize.getCustomizeMgr().isCustomizationUserDefault(custData)) {
       if (MessageDialog.openConfirm(
           Display.getCurrent().getActiveShell(),
           XViewerText.get("button.remove_default"),
           MessageFormat.format(
               XViewerText.get("XViewerCustomizeDialog.prompt.remove_default"),
               custData.getName()))) {
         xViewerToCustomize.getCustomizeMgr().setUserDefaultCustData(custData, false);
       }
     } else if (MessageDialog.openConfirm(
         Display.getCurrent().getActiveShell(),
         XViewerText.get("button.set_default"),
         MessageFormat.format(
             XViewerText.get("XViewerCustomizeDialog.prompt.set_default"), custData.getName()))) {
       xViewerToCustomize.getCustomizeMgr().setUserDefaultCustData(custData, true);
     }
     loadCustomizeTable();
   } catch (Exception ex) {
     XViewerLog.logAndPopup(Activator.class, Level.SEVERE, ex);
   }
 }
示例#4
0
  /** {@inheritDoc} */
  @Override
  protected void runModelAction() throws Exception {
    if (!MessageDialog.openConfirm(shell, Messages.RemoveScan, Messages.RemoveSelectedScan)) return;

    // Job because removal of many scans and data in log can be slow
    final ScanClient client = model.getScanClient();
    final Job job =
        new Job(Messages.RemoveScan) {
          @Override
          protected IStatus run(final IProgressMonitor monitor) {
            try {
              for (ScanInfo info : infos) client.removeScan(info.getId());
            } catch (final Exception ex) {
              shell
                  .getDisplay()
                  .asyncExec(
                      new Runnable() {
                        @Override
                        public void run() {
                          ExceptionDetailsErrorDialog.openError(shell, Messages.Error, ex);
                        }
                      });
            }
            return Status.OK_STATUS;
          }
        };
    job.setUser(true);
    job.schedule();
  }
  @Override
  public Object executeWithException(ExecutionEvent event, IStructuredSelection selection)
      throws OseeCoreException {
    Branch selectedBranch =
        Handlers.getBranchesFromStructuredSelection(selection).iterator().next();

    EntryDialog ed =
        new EntryDialog(
            "Set Associated Artifact",
            "Set Associated Artifact for Branch\n\n\""
                + selectedBranch.getName()
                + "\""
                + (selectedBranch.getAssociatedArtifactId() != null
                    ? "\n\nCurrently: " + selectedBranch.getAssociatedArtifactId()
                    : "")
                + "\n\nEnter new Artifact Id to associate:");
    ed.setEntry(String.valueOf(selectedBranch.getAssociatedArtifactId()));
    if (ed.open() == 0) {
      String artId = ed.getEntry();
      Artifact associatedArtifact =
          ArtifactQuery.getArtifactFromId(Integer.parseInt(artId), BranchManager.getCommonBranch());
      if (MessageDialog.openConfirm(
          Displays.getActiveShell(),
          "Set Associated Artifact",
          "Set Associated Artifact for Branch\n\n\""
              + selectedBranch.getName()
              + "\"\nto\nArtifact: "
              + associatedArtifact)) {
        selectedBranch.setAssociatedArtifactId(Integer.parseInt(artId));
        BranchManager.persist(selectedBranch);
      }
    }

    return null;
  }
  @Override
  public void run(IMarker marker) {
    try {
      final IViewPart view = EclipseUtil.findView(CodeMetricsView.ID);
      final CodeMetricsView codeMetricsView = (CodeMetricsView) view;
      final StringBuilder url = new StringBuilder();

      url.append("http://")
          .append(DexterClient.getInstance().getServerHost())
          .append(":") // $NON-NLS-1$ //$NON-NLS-2$
          .append(DexterClient.getInstance().getServerPort())
          .append(DexterConfig.CODE_METRICS_BASE); // $NON-NLS-1$
      // .append("?").append(DexterConfig.CODE_METRICS_FILE_NAME).append("=").append(fileName)//$NON-NLS-1$
      // .append("&").append(DexterConfig.CODE_METRICS_MODULE_PATH).append("=").append(modulePath);//$NON-NLS-1$

      codeMetricsView.setUrl(url.toString());
      EclipseUtil.showView(CodeMetricsView.ID);
    } catch (DexterRuntimeException e) {
      DexterEclipseActivator.LOG.error(e.getMessage(), e);
      MessageDialog.openConfirm(
          PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
          Messages.CodeMetricsResolution_CODE_METRICS_ERROR,
          Messages.CodeMetricsResolution_CODE_METRICS_ERROR_DESC);
    }
  }
 @Override
 public Object execute(ExecutionEvent event) throws ExecutionException {
   ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
   if (!selection.isEmpty()) {
     IStructuredSelection sSelection = (IStructuredSelection) selection;
     boolean confirmed =
         MessageDialog.openConfirm(
             HandlerUtil.getActiveShell(event),
             "Confirm Delete",
             "Please confirm that you wish to delete this metadata.");
     if (!confirmed) return null;
     MetsProjectNature mpn =
         MetsProjectNature.getNatureForMetsObject((EObject) sSelection.getFirstElement());
     HashSet<SmLinkType> del = new HashSet<SmLinkType>();
     Iterator it = sSelection.iterator();
     while (it.hasNext()) {
       Object sel = it.next();
       if (sel instanceof SmLinkType) {
         del.add((SmLinkType) sel);
       }
     }
     Command c =
         RemoveCommand.create(
             mpn.getEditingDomain(),
             mpn.getMets().getStructLink(),
             MetsPackage.eINSTANCE.getStructLinkType_SmLink(),
             del);
     mpn.getCommandStack().execute(c);
   }
   return null;
 }
示例#8
0
    public void run() {
      String msg =
          name
              + "数据被外部程序改变,是否重载?\n"
              + "注:如果选择是,所有已打开的编辑窗口将被关闭,数据不会保存;如果选择否,"
              + "那么在你继续编辑并保存数据时,将有可能覆盖别人的修改!";
      if (MessageDialog.openConfirm(getSite().getShell(), "警告", msg) == false) {
        return;
      }
      try {
        // 重载
        CrossGateEditor.getReloadManager().reload();

        // 刷新列表
        for (TreeViewer tv : dataTreeViewers) {
          tv.refresh();
        }

        // 关闭所有编辑器
        IEditorReference[] refs =
            getSite().getWorkbenchWindow().getActivePage().getEditorReferences();
        for (IEditorReference ref : refs) {
          IEditorPart editor = ref.getEditor(false);
          if (editor != null) {
            getSite().getWorkbenchWindow().getActivePage().closeEditor(editor, false);
          }
        }
      } catch (Exception e) {
        CrossGateEditor.getLog().error(getClass().getName(), e);
        //            	CrossGateEditor.catchException(e, false);
        MessageDialog.openError(getSite().getShell(), "错误", e.toString());
      }
    }
  @Override
  public void run() {
    if (!MessageDialog.openConfirm(
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
        getText(),
        "Are you sure you want to delete?")) {
      return;
    }

    for (SimpleUserNode node : viewer.getSelectedTreeNodes()) {
      SimpleUserNode project = node.getAncestorOfType(ServoyProject.class);
      if (project == null) {
        continue;
      }

      Pair<Solution, String> pair = (Pair<Solution, String>) node.getRealObject();
      String scopeName = pair.getRight();

      WorkspaceFileAccess wsfa =
          new WorkspaceFileAccess(
              ((IProjectNature) project.getRealObject()).getProject().getWorkspace());
      String scriptPath =
          SolutionSerializer.getRelativePath(
                  ((((ServoyProject) project.getRealObject()).getSolution())), false)
              + scopeName
              + SolutionSerializer.JS_FILE_EXTENSION;
      try {
        wsfa.delete(scriptPath);
      } catch (IOException e) {
        ServoyLog.logError(
            "Could not delete scope '" + scopeName + "' from project '" + project.getName() + "'",
            e);
      }
    }
  }
示例#10
0
 private void showMessageDialogConfirm() {
   String title = "Confirmation";
   String mesg = "Nothing will be done. Ok?";
   boolean result = MessageDialog.openConfirm(getShell(), title, mesg);
   messageDlgResLabel.setText("Result: " + result);
   messageDlgResLabel.pack();
 }
 @Override
 protected boolean handleKeyUp(KeyEvent ke) {
   int state = ke.getState();
   int key = ke.keyCode;
   if (state == 0 && key == SWT.DEL) {
     ISelection selection = viewer.getSelection();
     if (selection instanceof IStructuredSelection) {
       Object element = ((IStructuredSelection) selection).getFirstElement();
       if (element instanceof ITemplate) {
         ITemplate template = (ITemplate) element;
         if (MindMapUI.getResourceManager().isUserTemplate(template)) {
           if (MessageDialog.openConfirm(
               viewer.getControl().getShell(),
               WorkbenchMessages.ConfirmDeleteTemplateDialog_title,
               NLS.bind(
                   WorkbenchMessages.ConfirmDeleteTemplateDialog_message_withTemplateName,
                   template.getName()))) {
             MindMapUI.getResourceManager().removeUserTemplate(template);
           }
         }
       }
     }
   }
   return super.handleKeyUp(ke);
 }
示例#12
0
 private void handleDeleteButton() {
   try {
     CustomizeData custSel = getCustTableSelection();
     if (custSel.getName().equals(CustomizeManager.TABLE_DEFAULT_LABEL)
         || custSel.getName().equals(CustomizeManager.CURRENT_LABEL)) {
       XViewerLib.popup("ERROR", XViewerText.get("error.delete_default"));
       return;
     }
     if (!custSel.isPersonal() && !xViewerToCustomize.getXViewerFactory().isAdmin()) {
       XViewerLib.popup("ERROR", XViewerText.get("error.delete_global"));
       return;
     }
     if (MessageDialog.openConfirm(
         Display.getCurrent().getActiveShell(),
         XViewerText.get("XViewerCustomizeDialog.prompt.delete.title"),
         MessageFormat.format(
             XViewerText.get("XViewerCustomizeDialog.prompt.delete"), custSel.getName()))) {
       xViewerToCustomize.getCustomizeMgr().deleteCustomization(custSel);
       loadCustomizeTable();
       updateButtonEnablements();
     }
   } catch (Exception ex) {
     XViewerLog.logAndPopup(Activator.class, Level.SEVERE, ex);
   }
 }
  /** Edits a not run yet selection */
  protected void editSelection() {

    final StatusBean bean = getSelection();
    if (bean == null) return;

    if (bean.getStatus() != org.eclipse.scanning.api.event.status.Status.SUBMITTED) {
      MessageDialog.openConfirm(
          getSite().getShell(),
          "Cannot Edit '" + bean.getName() + "'",
          "The run '" + bean.getName() + "' cannot be edited because it is not waiting to run.");
      return;
    }

    try {
      final IConfigurationElement[] c =
          Platform.getExtensionRegistry()
              .getConfigurationElementsFor("org.eclipse.scanning.api.modifyHandler");
      if (c != null) {
        for (IConfigurationElement i : c) {
          final IModifyHandler handler = (IModifyHandler) i.createExecutableExtension("class");
          handler.init(service, createConsumerConfiguration());
          if (handler.isHandled(bean)) {
            boolean ok = handler.modify(bean);
            if (ok) return;
          }
        }
      }
    } catch (Exception ne) {
      ne.printStackTrace();
      ErrorDialog.openError(
          getSite().getShell(),
          "Internal Error",
          "Cannot modify "
              + bean.getRunDirectory()
              + " normally.\n\nPlease contact your support representative.",
          new Status(IStatus.ERROR, Activator.PLUGIN_ID, ne.getMessage()));
      return;
    }

    MessageDialog.openConfirm(
        getSite().getShell(),
        "Cannot Edit '" + bean.getName() + "'",
        "There are no editers registered for '"
            + bean.getName()
            + "'\n\nPlease contact your support representative.");
  }
  @Override
  protected String getTemplateType() {
    if (this.window != null) {
      this.editorPart =
          this.window.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    }
    final String fileName =
        this.editorPart == null ? EMPTY_STR : this.editorPart.getEditorInput().getName();
    String[] snippetTypes =
        TemplateSettings.getEnabledTemplateTypes(fileName, this.templatePrefix)
            .toArray(new String[0]);
    snippetTypes = removeExcludedTemplates(snippetTypes, EXCLUDED_TEMPLATES, fileName);
    if (snippetTypes == null || snippetTypes.length == 0) {
      return null;
    }

    final Shell shell =
        this.editorPart == null ? new Shell() : this.editorPart.getSite().getShell();

    final List<String> snpTypes = new ArrayList<String>();
    for (final String snpTyp : snippetTypes) {
      final TemplateSettings templateSetting = super.getTemplateSettings(snpTyp);
      if (templateSetting != null) {
        snpTypes.add(snpTyp);
      }
    }
    snippetTypes = snpTypes.toArray(new String[0]);
    if (snippetTypes == null || snippetTypes.length == 0) {
      return null;
    }
    if (snippetTypes.length == 1) {
      return MessageDialog.openConfirm(
              shell,
              "Confirm",
              "Only one snippet type available for this file, it is "
                  + makeWord(snippetTypes[0])
                  + ". Continue?")
          ? snippetTypes[0]
          : null;
    }

    for (int i = 0; i < snippetTypes.length; i++) {
      snippetTypes[i] =
          snippetTypes[i].replaceFirst("^" + this.templatePrefix + UNDERSCORE, EMPTY_STR);
    }
    final FastCodeSelectionDialog snippetSelectionDialog =
        new StringSelectionDialog(
            shell, "Snippet Types", "Please select one of the snippet types", snippetTypes, false);
    if (snippetSelectionDialog.open() == Window.CANCEL) {
      return null;
    }

    this.templateType =
        this.templatePrefix + UNDERSCORE + (String) snippetSelectionDialog.getResult()[0];
    this.description = makeWord(this.templateType);
    return this.templateType;
  }
示例#15
0
 public void run() {
   int length = elements.length;
   if (MessageDialog.openConfirm(
       getViewSite().getShell(),
       "Permanently Delete",
       length + " directories are deleted permanently with subdirectories. Continue?")) {
     new DeleteJob("Delete Files", elements).schedule();
   }
 }
示例#16
0
  @Override
  public void runWithEvent(final Event event) {
    final Shell shell = event.widget.getDisplay().getActiveShell();

    if (!MessageDialog.openConfirm(
        shell, getText(), Messages.getString("ClearDatasetAction_2"))) // $NON-NLS-1$
    return;

    m_data.clearElements();
  }
示例#17
0
 @Execute
 public void execute(
     IWorkbench workbench,
     IEclipseContext context,
     @Named(IServiceConstants.ACTIVE_SHELL) Shell shell)
     throws InvocationTargetException, InterruptedException {
   if (MessageDialog.openConfirm(shell, "Confirmation", "Do you want to exit?")) {
     workbench.close();
   }
 }
 @Override
 public boolean close() {
   if (isChange()) {
     if (MessageDialog.openConfirm(getShell(), "", "确定不保存就关闭吗?")) {
       return super.close();
     }
   } else {
     return super.close();
   }
   return false;
 }
  /**
   * Prompts the user if they really want to delete the given item. If the user consents, the item
   * is deleted. Otherwise, no action is taken.
   *
   * @param toDelete The item to delete.
   * @param editor The editor in which the delete is taking place.
   * @return the parent of the element before its deletion, or <code>null</code> if no element is
   *     deleted.
   */
  private Object deleteSingleElement(Object toDelete, ObjectMappingMultiPageEditor editor) {

    boolean delete = false;
    Object lastParent = null;
    if (toDelete instanceof IObjectMappingAssoziationPO) {
      delete =
          MessageDialog.openConfirm(
              getActiveShell(),
              Messages.DeleteTreeItemActionOMEditorOMTitle,
              Messages.DeleteTreeItemActionOMEditorOMText1);
      if (delete) {
        lastParent =
            editor.getOmEditorBP().deleteAssociation((IObjectMappingAssoziationPO) toDelete);
        editor.getEditorHelper().setDirty(true);
      }
    } else if (toDelete instanceof IComponentNamePO) {
      delete =
          MessageDialog.openConfirm(
              getActiveShell(),
              Messages.DeleteTreeItemActionOMEditorOMTitle,
              Messages.DeleteTreeItemActionOMEditorOMText2);
      if (delete) {
        lastParent = editor.getOmEditorBP().deleteCompName((IComponentNamePO) toDelete);
        editor.getEditorHelper().setDirty(true);
      }
    } else if (toDelete instanceof IObjectMappingCategoryPO) {
      delete =
          MessageDialog.openConfirm(
              getActiveShell(),
              Messages.DeleteTreeItemActionOMEditorOMTitle,
              Messages.DeleteTreeItemActionOMEditorOMText4);
      if (delete) {
        lastParent = editor.getOmEditorBP().deleteCategory((IObjectMappingCategoryPO) toDelete);
        editor.getEditorHelper().setDirty(true);
      }
    }
    return lastParent;
  }
示例#20
0
 public void handleEvent(Event e) {
   if (e.widget == this) {
     if (e.type == SWT.Close) {
       e.doit = false;
       if (MessageDialog.openConfirm(this, "Cancel", "Do you really want to cancel it?")) {
         running = false;
         lblMsg.setText("Canceling...");
         lblFile.setText("");
         Util.closeQuietly(out, log);
         Util.closeQuietly(in, log);
         Util.closeQuietly(socket, log);
         dispose();
       }
     }
   }
 }
  /** {@inheritDoc} */
  @Override
  public boolean performOk() {

    if (isDirty) {
      // Activator.setSystemVariables();
      boolean isAutoDelete = false;
      String downloadPath = null;
      boolean isAutoDownload = fieldEnableAutoDownload.getBooleanValue();

      if (isAutoDownload) {
        isAutoDelete = fieldEnableAutoDelete.getBooleanValue();
        downloadPath = fieldDownloadPath.getStringValue();
      }

      if (isAutoDownload && ((downloadPath == null) || (downloadPath.length() == 0))) {
        String message =
            "'Download Path' is empty. This will set the download path to default path "
                + new Path(System.getProperty("user.home") + "/" + DEFAULT_DOWNLOAD_DIRECTORY)
                    .toOSString();
        boolean response =
            MessageDialog.openConfirm(
                getFieldEditorParent().getShell(), "Confirm default path", message);

        // Return
        if (!response) {
          return false;
        }
        downloadPath =
            new Path(System.getProperty("user.home") + "/" + DEFAULT_DOWNLOAD_DIRECTORY)
                .toOSString();
        fieldDownloadPath.setStringValue(downloadPath);

        // Check if download directory exists. If not, create it.
        File directory = new File(downloadPath);
        if (!directory.exists()) {
          directory.mkdirs();
        }
      }
      updateBackendService(fieldEnableAutoDownload.getBooleanValue(), isAutoDelete, downloadPath);
    }

    // We need to do this check, when some property change, to refresh the valid state
    fieldDownloadPath.isValid();

    boolean perform = super.performOk();
    return perform;
  }
示例#22
0
  /** Actually remove the python nature from the project. */
  public void run(IAction action) {
    if (selectedProject == null) {
      return;
    }

    if (!MessageDialog.openConfirm(
        null,
        "Confirm Remove Pydev Nature",
        org.python.pydev.shared_core.string.StringUtils.format(
            "Are you sure that you want to remove the Pydev nature from %s?",
            selectedProject.getName()))) {
      return;
    }

    try {
      PythonNature.removeNature(selectedProject, null);
    } catch (Throwable e) {
      Log.log(e);
    }
  }
 private void deleteProfile() {
   if (profilesTable.getSelectionCount() != 1) {
     return;
   }
   TableItem item = profilesTable.getSelection()[0];
   TeaVMProfile profile = (TeaVMProfile) item.getData();
   if (!profile.getExternalToolId().isEmpty()) {
     return;
   }
   boolean confirmed =
       MessageDialog.openConfirm(
           getShell(),
           "Deletion confirmation",
           "Are you sure to delete profile " + item.getText(0) + "?");
   if (!confirmed) {
     return;
   }
   settings.deleteProfile((TeaVMProfile) item.getData());
   item.dispose();
 }
  public Object execute(ExecutionEvent event) throws ExecutionException {
    try {
      String name = event.getCommand().getName();
      Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();

      if (!MessageDialog.openConfirm(
          shell,
          Messages.JavaBeansGeneratorAction_MSG_DIALOG_MESSAGE,
          name + Messages.JavaBeansGeneratorAction_MSG_DIALOG_DESC)) {
        return null;
      }

      /* 実行中のダイアログ表示 */
      ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
      dialog.setCancelable(true);

      IWorkbenchPartSite site = HandlerUtil.getActivePartChecked(event).getSite();
      ISelection selection = HandlerUtil.getCurrentSelection(event);
      IStructuredSelection ss = null;
      if (selection instanceof IStructuredSelection) {
        ss = (IStructuredSelection) selection;
      }

      try {
        logger.debug("execute"); // $NON-NLS-1$
        String id = event.getCommand().getId();
        JavaBeansCreatorWithProgress progress = new JavaBeansCreatorWithProgress(ss, site, id);
        dialog.run(true, true, progress);
      } catch (InvocationTargetException e) {
        Activator.logException(e);
      } catch (InterruptedException e) {
        Activator.logException(e, false);
      }
    } catch (NotDefinedException e) {
      Activator.logException(e);
    }
    return null;
  }
示例#25
0
 /**
  * 对选中的文本段进行过滤
  *
  * @param isSignedOff
  * @return ;
  */
 public List<String> getRowIdsNoEmptyTranslate(boolean isSignedOff) {
   List<String> selRowIds = xliffEditor.getSelectedRowIds();
   int oldSize = selRowIds.size();
   XLFHandler handler = xliffEditor.getXLFHandler();
   handler.removeNullTgtContentRowId(selRowIds);
   boolean hasEmpty = false;
   boolean hasDraft = false;
   if (oldSize != selRowIds.size()) {
     hasEmpty = true;
   }
   if (isSignedOff) { // 判断执行签发时是否有草稿状态的文本段
     for (int i = 0; i < selRowIds.size(); i++) {
       String rowId = selRowIds.get(i);
       if (handler.isDraft(rowId)) {
         selRowIds.remove(i);
         i--;
         hasDraft = true;
       }
     }
   }
   String message = null;
   if (hasEmpty && hasDraft) {
     message = Messages.getString("utils.NattableUtil.msg8");
   } else if (hasDraft) {
     message = Messages.getString("utils.NattableUtil.msg9");
   } else if (hasEmpty) {
     message = Messages.getString("utils.NattableUtil.msg1");
   }
   if (message != null) {
     if (!MessageDialog.openConfirm(
         xliffEditor.getTable().getShell(),
         Messages.getString("utils.NattableUtil.msgTitle"),
         message)) {
       selRowIds.clear();
     }
   }
   return selRowIds;
 }
 protected void onClickDelete() {
   Grid g = gridViewer.getGrid();
   if (g.getSelectionIndex() == -1) {
     MessageDialog.openInformation(shell, "데이터 선택 필요", "선택된 데이터가 없습니다. \n\n목록에서 선택 후 작업하세요.");
     return;
   } else {
     if (listData != null && listData.length > g.getSelectionIndex()) {
       boolean rtn =
           MessageDialog.openConfirm(
               shell,
               "삭제 확인",
               "1차 계량 정보를 삭제하시겠습니까?\n\n차량번호-" + listData[g.getSelectionIndex()].getCar_num());
       if (!rtn) {
         return;
       }
       try {
         TsWgtInfManager wim = new TsWgtInfManager();
         TsWgtInfDTO dto = (TsWgtInfDTO) ObjectUtil.getDefaultObject(TsWgtInfDTO.class.getName());
         dto.setDel_yn(DTSConstants.FLAG_Y);
         dto.setWgt_cd(listData[g.getSelectionIndex()].getWgt_cd());
         wim.updateTsWgtInf(dto);
         // 목록 재조회
         select();
         // HomeView refresh
         HomeView hv =
             (HomeView)
                 PlatformUI.getWorkbench()
                     .getActiveWorkbenchWindow()
                     .getActivePage()
                     .findView(HomeView.ID);
         hv.refreshData();
       } catch (IOException e) {
         MessageDialog.openError(shell, "삭제 오류", "데이터 삭제 중 오류가 발생하였습니다. \n\n" + e.getMessage());
         return;
       }
     }
   }
 }
 public void doWork() {
   int index = contextValuesTable.getSelectionIndex();
   if (index >= 0) {
     try {
       boolean confirm =
           MessageDialog.openConfirm(
               new Shell(),
               "Confirmation",
               "Are you sure you want to delete this context value?");
       if (confirm) {
         String key = contextValuesTable.getSelection()[0].getText(0);
         ContextValue value =
             ConfigurationManager.getInstance(vEditor.getFile().getProject())
                 .getContextValue(key, vEditor.getFile(), false);
         ConfigurationManager.getInstance(vEditor.getFile().getProject())
             .removeContextValue(value.name, vEditor.getFile());
         reloadContextValues();
       }
     } catch (Exception e1) {
       Plugin.error(e1);
     }
   }
 }
 protected void buttonPressed(int buttonId) {
   if (buttonId == IDialogConstants.OK_ID) {
     editObject.format = formats[comboTextureType.getSelectionIndex()];
     editObject.sizeWidth = sizes[comboTextureSize.getSelectionIndex()];
     editObject.sizeHeight = editObject.sizeWidth;
     try {
       editObject.borderWidth = Integer.parseInt(textBorderWidth.getText());
       if (editObject.borderWidth < 0 || editObject.borderWidth > 10) {
         throw new Exception();
       }
     } catch (Exception e) {
       MessageDialog.openError(this.getShell(), "错误", "描边宽度:请输入0-10之间的整数。");
       return;
     }
     if (CompressTextureOption.ETC1.equals(editObject.format)) {
       String msg = "ETC1格式不支持透明色,你确定你要使用这个格式吗?";
       if (!MessageDialog.openConfirm(getShell(), "确认", msg)) {
         return;
       }
     }
   }
   super.buttonPressed(buttonId);
 }
  /**
   * Combined operation of creating make targets in Make Target View from multiline text. The method
   * will ask a confirmation if user tries to drop more then 1 target to prevent easily made mistake
   * of unintended copying of old contents of the clipboard.
   *
   * @param multilineText - input make target commands in textual form.
   * @param dropContainer - container where add the targets.
   * @param operation - operation such as copying or moving. Must be a {@link
   *     org.eclipse.swt.dnd.DND} operation.
   * @param shell - a shell to display progress of operation to user.
   * @see DND#DROP_NONE
   * @see DND#DROP_COPY
   * @see DND#DROP_MOVE
   * @see DND#DROP_LINK
   */
  public static void createMultilineTargetsUI(
      String multilineText, IContainer dropContainer, int operation, Shell shell) {

    IMakeTarget[] makeTargets = prepareMakeTargetsFromString(multilineText, dropContainer);
    boolean confirmed = true;
    if (makeTargets.length > 1) {
      String title =
          MakeUIPlugin.getResourceString(
              "MakeTargetDnD.title.createFromTextConfirm"); //$NON-NLS-1$
      String question =
          MessageFormat.format(
              MakeUIPlugin.getResourceString(
                  "MakeTargetDnD.message.createFromTextConfirm"), //$NON-NLS-1$
              new Object[] {new Integer(makeTargets.length)});

      String topTargets = ""; // $NON-NLS-1$
      for (int i = 0; i < makeTargets.length; i++) {
        // limit dimensions of the confirm dialog
        final int HEIGHT_LIMIT = 20;
        final int LENGTH_LIMIT = 200;
        if (i > HEIGHT_LIMIT) {
          topTargets = topTargets + "..."; // $NON-NLS-1$
          break;
        }
        String name = makeTargets[i].getName();
        if (name.length() > LENGTH_LIMIT) {
          name = name.substring(0, LENGTH_LIMIT - 3) + "..."; // $NON-NLS-1$
        }
        topTargets = topTargets + name + "\n"; // $NON-NLS-1$
      }

      confirmed = MessageDialog.openConfirm(shell, title, question + topTargets);
    }
    if (confirmed) {
      MakeTargetDndUtil.copyTargets(makeTargets, dropContainer, operation, shell);
    }
  }
示例#30
0
  @SuppressWarnings("rawtypes")
  public void run() {
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    TreeParent parent = null;

    for (Iterator nextSelection = selection.iterator(); nextSelection.hasNext(); ) {
      Object obj = nextSelection.next();
      if (TreeObject.class.isInstance(obj)) {
        if (((TreeObject) obj).getTableDefinition() != null) {
          TableDefinition tableDefinition = ((TreeObject) obj).getTableDefinition();

          boolean confirm =
              MessageDialog.openConfirm(
                  viewer.getControl().getShell(),
                  DELETE_TABLE,
                  String.format(
                      WARNING_THIS_ACTION_WILL_DELETE_THE_TABLE_AND_ALL_OF_ITS_CONTENT_CONTINUE,
                      tableDefinition.getTableName()));
          if (!confirm) {
            continue;
          }
          parent = ((TreeObject) obj).getParent();
          IDatabaseConnectionFactory connectionFactory = parent.getConnectionFactory();
          try {
            deleteTable(tableDefinition, connectionFactory);
          } catch (SQLException e) {
            showMessage(String.format(FAILED_TO_DELETE_TABLE_S, tableDefinition.getTableName()));
            logger.error(e.getMessage(), e);
          }
        }
      }
    }
    if (parent != null) {
      RefreshViewAction refresh = new RefreshViewAction(viewer, parent.getChildren()[0]);
      refresh.run();
    }
  }