当前位置: 首页>>代码示例>>Java>>正文


Java MessageDialog.WARNING属性代码示例

本文整理汇总了Java中org.eclipse.jface.dialogs.MessageDialog.WARNING属性的典型用法代码示例。如果您正苦于以下问题:Java MessageDialog.WARNING属性的具体用法?Java MessageDialog.WARNING怎么用?Java MessageDialog.WARNING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jface.dialogs.MessageDialog的用法示例。


在下文中一共展示了MessageDialog.WARNING属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final String alloyFilePath = MarkerPage.settings.get("alloyFile");
  try {
    TraceManager.get().loadSpec(alloyFilePath);
    final AlloyToEMF alloy2emf = new AlloyToEMF(alloyFilePath);
    alloy2emf.start();
    Display.getDefault().syncExec(new Runnable() {

      @Override
      public void run() {
        Visualization.showViz();
      }
    });
  } catch (final TraceException e) {
    final MessageDialog warningdialog = new MessageDialog(MarkerActivator.getShell(),
        "Alloy To EMF", null, e.getMessage(), MessageDialog.WARNING, new String[] {"OK"}, 0);
    if (warningdialog.open() != 0) {
      return null;
    }
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:23,代码来源:AlloyToEMFHandler.java

示例2: execute

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final MessageDialog warningdialog =
      new MessageDialog(MarkerActivator.getShell(), "Mark Information", null,
          "If new alloy file will be parsed , your all marker type will be lost !",
          MessageDialog.WARNING, new String[] {"OK", "Cancel"}, 0);
  if (warningdialog.open() != 0) {
    return null;
  }

  final String filePath = getFilePath();
  if (filePath == null) {
    return null;
  }
  AlloyParseUtil.parse(filePath);

  try {
    TraceManager.get().loadSpec(filePath);
  } catch (final TraceException e) {
    e.printStackTrace();
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:23,代码来源:LoadSpecificationHandler.java

示例3: execute

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
  try {
    IFile file = AlloyParseUtil.getSelectedFile();
    if (file != null) {
      EMFToAlloy emfToAlloy = new EMFToAlloy(file);
      emfToAlloy.start();
    }
  } catch (IOException e) {
    final MessageDialog warningdialog =
        new MessageDialog(MarkerActivator.getShell(), "Alloy Example To EMF", null,
            e.getMessage(), MessageDialog.WARNING, new String[] {"OK"}, 0);
    if (warningdialog.open() != 0) {
      return null;
    }
    e.printStackTrace();
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:19,代码来源:EmfToAlloyHandler.java

示例4: open

@Override
public void open() {

  final IFile file = MarkerActivator.getEditor().getEditorInput().getAdapter(IFile.class);

  final int start = this.fUrlRegion.getOffset();
  final int end = this.fUrlRegion.getOffset() + this.fUrlRegion.getLength();
  final IMarker beMapped = MarkerFactory.findMarkerWithAbsolutePosition(file, start, end);

  if (beMapped != null) {
    MarkerMapping.getInstance().runWithMarker(beMapped);
  } else {
    final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Mark Information",
        null, "Something goes wrong with this text fragments", MessageDialog.WARNING,
        new String[] {"OK"}, 0);
    dialog.open();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:MarkerMappingActionHyperlink.java

示例5: execute

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final MessageDialog warningDialog = new MessageDialog(MarkerActivator.getShell(), "Warning!",
      null, "You are about to delete all markers! Do you want to continue?",
      MessageDialog.WARNING, new String[] {"Yes", "No"}, 0);
  if (warningDialog.open() != 0) {
    return null;
  }

  if (AlloyUtilities.isExists()) {
    AlloyOtherSolutionReasoning.getInstance().finish();

    AlloyUtilities.clearRepository();
    AlloyUtilities.clearRelation();
    AlloyUtilities.clearSigs();
    AlloyUtilities.clearFields();

    try {
      ResourcesPlugin.getWorkspace().getRoot().deleteMarkers(MarkerFactory.MARKER_MARKING, true,
          IResource.DEPTH_INFINITE);
    } catch (final CoreException e) {
      e.printStackTrace();
    }

    refreshActiveEditor();
  } else {
    final MessageDialog infoDialog = new MessageDialog(MarkerActivator.getShell(),
        "System Information", null, "You dont have any registered alloy file to system.",
        MessageDialog.INFORMATION, new String[] {"OK"}, 0);
    infoDialog.open();
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:33,代码来源:DeleteAllTraceElementsHandler.java

示例6: createMarkersWs

private void createMarkersWs() {
  ITextSelection textSelection = (ITextSelection) this.selection;
  if (MarkerFactory.findMarkerWithAbsolutePosition(this.file, textSelection.getOffset(),
      textSelection.getOffset() + textSelection.getLength()) != null) {
    MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Mark Information", null,
        "In these area, there is already a marker", MessageDialog.WARNING, new String[] {"OK"},
        0);
    dialog.open();
    return;
  } else {
    MarkAllInWsWizard markAllWsWizard = new MarkAllInWsWizard(textSelection, this.file);
    WizardDialog selectionDialog = new WizardDialog(MarkerActivator.getShell(), markAllWsWizard);
    selectionDialog.open();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:15,代码来源:MarkAllInWorkspaceHandler.java

示例7: deleteMarkers

private void deleteMarkers() {
  this.editor =
      PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
  this.file = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
      .getActiveEditor().getEditorInput().getAdapter(IFile.class);
  this.selection =
      PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();

  try {
    final IMarker beDeleted = this.getMarker();
    if (beDeleted != null && beDeleted.exists()) {
      final MessageDialog warningDialog =
          new MessageDialog(MarkerActivator.getShell(), "Warning!", null,
              "If you delete markers, all relations of these markers has been removed! Do you want to continue to delete markers?",
              MessageDialog.WARNING, new String[] {"YES", "NO"}, 0);
      if (warningDialog.open() != 0) {
        return;
      }

      this.findCandidateToTypeChangingMarkers(beDeleted);
      final String sourceIdOfSelectedMarker = MarkUtilities.getSourceId(beDeleted);

      for (final IMarker iMarker : this.candidateToTypeChanging) {
        AnnotationFactory.convertAnnotationType(iMarker, true,
            MarkUtilities.compare(MarkUtilities.getSourceId(iMarker), sourceIdOfSelectedMarker),
            AlloyUtilities.getTotalTargetCount(iMarker));
      }
      final String markerText = MarkUtilities.getText(beDeleted);

      if (MarkUtilities.getGroupId(beDeleted) != null) {
        final String markerGroupId = MarkUtilities.getGroupId(beDeleted);
        final List<IMarker> markers =
            MarkerFactory.findMarkersByGroupId(this.file, markerGroupId);

        for (int i = markers.size() - 1; i >= 0; i--) {
          this.deleteFromAlloyXML(markers.get(i));
          AnnotationFactory.removeAnnotation(markers.get(i));
          markers.get(i).delete();
        }
      } else {
        this.deleteFromAlloyXML(beDeleted);
        AnnotationFactory.removeAnnotation(beDeleted);
        beDeleted.delete();
      }
      final MessageDialog dialog =
          new MessageDialog(MarkerActivator.getShell(), "Mark will be deleted by this wizard",
              null, "\"" + markerText + "\" has been selected to be unmarked",
              MessageDialog.INFORMATION, new String[] {"OK"}, 0);
      dialog.open();
    }

  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:55,代码来源:DeleteAllHandler.java

示例8: addRemoveType

private void addRemoveType() {
  if (!MarkerPage.isParsed()) {
    final MessageDialog parseCtrlDialog =
        new MessageDialog(MarkerActivator.getShell(), "Type Information", null,
            "You dont have any marker type registered to system! \n"
                + "Please parse an alloy file first",
                MessageDialog.INFORMATION, new String[] {"OK"}, 0);
    parseCtrlDialog.open();
    return;
  }

  final ActionSelectionDialog actionSelectionDialog =
      new ActionSelectionDialog(MarkerActivator.getShell());
  actionSelectionDialog.open();
  if (actionSelectionDialog.getReturnCode() == IDialogConstants.CANCEL_ID) {
    return;
  }

  if (selectedMarker != null && selectedMarker.exists()) {
    findCandidateToTypeChangingMarkers(selectedMarker);
    if (actionSelectionDialog.getReturnCode() == IDialogConstants.YES_ID) {
      addType(selectedMarker);
    } else if (actionSelectionDialog.getReturnCode() == IDialogConstants.NO_ID) {
      final MessageDialog warningDialog =
          new MessageDialog(MarkerActivator.getShell(), "Warning!", null,
              "If you remove marker's type, all relations of this marker has been removed! Do you want to continue to remove marker's type?",
              MessageDialog.WARNING, new String[] {"Yes", "No"}, 0);
      final int returnCode = warningDialog.open();
      if (returnCode != 0) {
        return;
      }
      removeType(selectedMarker);
    }
    // MarkerUpdater.updateTargets(selectedMarker);
    // MarkerUpdater.updateSources(selectedMarker);
  } else {
    final MessageDialog dialog =
        new MessageDialog(MarkerActivator.getShell(), "There is no marker in this position", null,
            "Please select valid marker", MessageDialog.INFORMATION, new String[] {"Ok"}, 0);
    dialog.open();
    return;
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:43,代码来源:AddRemoveTypeHandler.java

示例9: deleteMarker

private void deleteMarker() {
  try {
    if (marker != null && marker.exists()) {
      final MessageDialog warningDialog =
          new MessageDialog(MarkerActivator.getShell(), "Warning!", null,
              "If you delete marker, all relations of this marker has been removed! Do you want to continue to delete marker?",
              MessageDialog.WARNING, new String[] {"YES", "NO"}, 0);
      if (warningDialog.open() != 0) {
        return;
      }

      findCandidateToTypeChangingMarkers(marker);
      final String sourceIdOfSelectedMarker = MarkUtilities.getSourceId(marker);

      for (final IMarker iMarker : candidateToTypeChanging) {
        AnnotationFactory.convertAnnotationType(iMarker, true,
            MarkUtilities.compare(MarkUtilities.getSourceId(iMarker), sourceIdOfSelectedMarker),
            AlloyUtilities.getTotalTargetCount(iMarker));
      }
      final String markerText = MarkUtilities.getText(marker);

      if (MarkUtilities.getLeaderId(marker) != null) {
        final String markerGroupId = MarkUtilities.getGroupId(marker);
        final List<IMarker> markers = MarkerFactory.findMarkersByGroupId(file, markerGroupId);

        for (int i = markers.size() - 1; i >= 0; i--) {
          deleteFromAlloyXML(markers.get(i));
          AnnotationFactory.removeAnnotation(markers.get(i));
          markers.get(i).delete();
        }
      } else {
        deleteFromAlloyXML(marker);
        AnnotationFactory.removeAnnotation(marker);
        marker.delete();
      }
      final MessageDialog dialog =
          new MessageDialog(MarkerActivator.getShell(), "Mark will be deleted by this wizard",
              null, "\"" + markerText + "\" has been selected to be unmarked",
              MessageDialog.INFORMATION, new String[] {"OK"}, 0);
      dialog.open();
    }
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:45,代码来源:DeleteHandler.java

示例10: execute

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final String filePath = getFilePath();
  if (filePath == null) {
    return null;
  }

  final IEditorPart editor = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow()
      .getActivePage().getActiveEditor();;

  if (editor == null) {
    return null;
  }

  if (editor.isDirty()) {
    final IFile file = ResourceUtil.getFile(editor.getEditorInput());
    final MessageDialog warningdialog =
        new MessageDialog(MarkerActivator.getShell(), "Save Specification", null,
            file.getName()
                + " has been modified. You must save file for update the specification. Do you want to save now?",
            MessageDialog.WARNING, new String[] {"Yes", "No"}, 0);
    if (warningdialog.open() != 0) {
      return null;
    }

    AlloyOtherSolutionReasoning.getInstance().finish();
    editor.doSave(new NullProgressMonitor());
  }

  final String content = getContent(filePath);
  if (content == null) {
    return null;
  }

  AlloyUtilities.updateSpec(filePath, content);

  try {
    TraceManager.get().loadSpec(filePath);
  } catch (final TraceException e) {
    e.printStackTrace();
  }

  final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Status Information",
      null, "Specification has been updated.", MessageDialog.INFORMATION, new String[] {"OK"}, 0);
  dialog.open();

  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:48,代码来源:UpdateSpecificationHandler.java

示例11: onException

public void onException(TraceException e) {
  final MessageDialog warningdialog = new MessageDialog(null, "Alloy To EMF", null,
      e.getMessage(), MessageDialog.WARNING, new String[] {"OK"}, 0);
  warningdialog.open();
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:5,代码来源:AlloyToEMF.java

示例12: addRemoveType

private void addRemoveType() {
  if (!MarkerPage.isParsed()) {
    final MessageDialog parseCtrlDialog =
        new MessageDialog(Activator.getShell(), "Type Information", null,
            "You dont have any marker type registered to system! \n"
                + "Please parse an alloy file first",
            MessageDialog.INFORMATION, new String[] {"OK"}, 0);
    parseCtrlDialog.open();
    return;
  }

  final ActionSelectionDialog actionSelectionDialog =
      new ActionSelectionDialog(Activator.getShell());
  actionSelectionDialog.open();
  if (actionSelectionDialog.getReturnCode() == IDialogConstants.CANCEL_ID) {
    return;
  }

  IMarker selectedMarker = this.marker;
  selectedMarker = MarkUtilities.getLeaderOfMarker(selectedMarker);

  if (selectedMarker != null && selectedMarker.exists()) {
    this.findCandidateToTypeChangingMarkers(selectedMarker);
    if (actionSelectionDialog.getReturnCode() == IDialogConstants.YES_ID) {
      AddRemoveTypeCommand.addType(selectedMarker);
    } else if (actionSelectionDialog.getReturnCode() == IDialogConstants.NO_ID) {
      final MessageDialog warningDialog =
          new MessageDialog(Activator.getShell(), "Warning!", null,
              "If you remove marker's type, all relations of this marker has been removed! Do you want to continue to remove marker's type?",
              MessageDialog.WARNING, new String[] {"YES", "NO"}, 0);
      final int returnCode = warningDialog.open();
      if (returnCode != 0) {
        return;
      }
      this.removeType(selectedMarker);
    }
  } else {
    final MessageDialog dialog =
        new MessageDialog(Activator.getShell(), "There is no marker in this position", null,
            "Please select valid marker", MessageDialog.INFORMATION, new String[] {"OK"}, 0);
    dialog.open();
    return;
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:44,代码来源:AddRemoveTypeCommand.java

示例13: deleteMarker

private void deleteMarker() {
  try {
    final IMarker beDeleted = marker;
    if (beDeleted != null && beDeleted.exists()) {
      final MessageDialog warningDialog =
          new MessageDialog(Activator.getShell(), "Warning!", null,
              "If you delete marker, all relations of this marker has been removed! Do you want to continue to delete marker?",
              MessageDialog.WARNING, new String[] {"YES", "NO"}, 0);
      if (warningDialog.open() != 0) {
        return;
      }

      findCandidateToTypeChangingMarkers(beDeleted);
      final String sourceIdOfSelectedMarker = MarkUtilities.getSourceId(beDeleted);

      for (final IMarker iMarker : candidateToTypeChanging) {
        AnnotationFactory.convertAnnotationType(iMarker, true,
            MarkUtilities.compare(MarkUtilities.getSourceId(iMarker), sourceIdOfSelectedMarker),
            AlloyUtilities.getTotalTargetCount(iMarker));
      }
      final String markerText = MarkUtilities.getText(beDeleted);

      if (MarkUtilities.getLeaderId(beDeleted) != null) {
        final String markerGroupId = MarkUtilities.getGroupId(beDeleted);
        final List<IMarker> markers =
            MarkerFactory.findMarkersByGroupId(beDeleted.getResource(), markerGroupId);

        for (int i = markers.size() - 1; i >= 0; i--) {
          deleteFromAlloyXML(markers.get(i));
          AnnotationFactory.removeAnnotation(markers.get(i));
          markers.get(i).delete();
        }
      } else {
        deleteFromAlloyXML(beDeleted);
        AnnotationFactory.removeAnnotation(beDeleted);
        beDeleted.delete();
      }
      final MessageDialog dialog =
          new MessageDialog(Activator.getShell(), "Mark will be deleted by this wizard", null,
              "\"" + markerText + "\" has been selected to be unmarked",
              MessageDialog.INFORMATION, new String[] {"OK"}, 0);
      dialog.open();
    }
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:47,代码来源:DeleteAtomCommand.java


注:本文中的org.eclipse.jface.dialogs.MessageDialog.WARNING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。