本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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;
}
}
示例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();
}
}
示例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;
}
示例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();
}
示例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;
}
}
示例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();
}
}