本文整理汇总了Java中org.eclipse.compare.CompareUI.openCompareDialog方法的典型用法代码示例。如果您正苦于以下问题:Java CompareUI.openCompareDialog方法的具体用法?Java CompareUI.openCompareDialog怎么用?Java CompareUI.openCompareDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.compare.CompareUI
的用法示例。
在下文中一共展示了CompareUI.openCompareDialog方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openCompareUI
import org.eclipse.compare.CompareUI; //导入方法依赖的package包/类
@Override
public void openCompareUI(final CompareEditorInput input) {
boolean legacy = true;
try {
CompareEditorInput.class.getDeclaredMethod("okPressed", (Class[]) null); //$NON-NLS-1$
legacy = false;
} catch (final Exception e) {
}
if (legacy) {
CompatibleCompareUI.openCompareDialog(input);
} else {
/*
* The Eclipse compare dialog can be used with 3.3 and higher
* since it was fixed.
*/
CompareUI.openCompareDialog(input);
}
}
示例2: run
import org.eclipse.compare.CompareUI; //导入方法依赖的package包/类
@Override
public void run(ISelection selection) {
IMember input= getEditionElement(selection);
if (input == null) {
MessageDialog.openInformation(getShell(), CompareMessages.CompareWithHistory_title, CompareMessages.CompareWithHistory_invalidSelectionMessage);
return;
}
JavaElementHistoryPageSource pageSource = JavaElementHistoryPageSource.getInstance();
final IFile file= pageSource.getFile(input);
if (file == null) {
MessageDialog.openError(getShell(), CompareMessages.CompareWithHistory_title, CompareMessages.CompareWithHistory_internalErrorMessage);
return;
}
if (USE_MODAL_COMPARE) {
CompareConfiguration cc = new CompareConfiguration();
cc.setLeftEditable(false);
cc.setRightEditable(false);
HistoryPageCompareEditorInput ci = new HistoryPageCompareEditorInput(cc, pageSource, input);
ci.setTitle(CompareMessages.JavaCompareWithEditionActionImpl_0);
ci.setHelpContextId(IJavaHelpContextIds.COMPARE_ELEMENT_WITH_HISTORY_DIALOG);
CompareUI.openCompareDialog(ci);
} else {
TeamUI.showHistoryFor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), input, pageSource);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:JavaCompareWithEditionActionImpl.java
示例3: execute
import org.eclipse.compare.CompareUI; //导入方法依赖的package包/类
/**
* The command has been executed, so extract the needed information
* from the application context.
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
if (currentSelection != null && currentSelection instanceof IStructuredSelection) {
// Retrieve file corresponding to current selection.
IStructuredSelection selection = (IStructuredSelection)currentSelection;
IFile selectionFile = (IFile)selection.getFirstElement();
// Open compare target selection dialog.
CompareTargetSelectionDialog dialog = new CompareTargetSelectionDialog(
HandlerUtil.getActiveShellChecked(event),
selectionFile.getName());
if (dialog.open() != Window.OK) {
return null;
}
// Ask concrete subclass to parse source file and extract Route for comparison.
Route left = extractRouteFromFile(selectionFile);
// Retrieve EMF Object corresponding to selected reference Route.
Route right = dialog.getSelectedRoute();
// Cause Spring parser cannot retrieve route name, force it using those of the model.
// TODO Find a fix later for that in the generator/parser couple
left.setName(right.getName());
// Launch EMFCompare UI with input.
EMFCompareConfiguration configuration = new EMFCompareConfiguration(new CompareConfiguration());
ICompareEditingDomain editingDomain = EMFCompareEditingDomain.create(left, right, null);
AdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
EMFCompare comparator = EMFCompare.builder().setPostProcessorRegistry(EMFCompareRCPPlugin.getDefault().getPostProcessorRegistry()).build();
IComparisonScope scope = new DefaultComparisonScope(left, right, null);
CompareEditorInput input = new ComparisonScopeEditorInput(configuration, editingDomain, adapterFactory, comparator, scope);
CompareUI.openCompareDialog(input);
}
return null;
}
示例4: run
import org.eclipse.compare.CompareUI; //导入方法依赖的package包/类
@Override
public void run(ISelection selection) {
Shell shell= getShell();
final IMember input= getEditionElement(selection);
if (input == null) {
MessageDialog.openInformation(shell, CompareMessages.ReplaceFromHistory_title, CompareMessages.ReplaceFromHistory_invalidSelectionMessage);
return;
}
final IFile file= getFile(input);
if (file == null) {
showError();
return;
}
IStatus status= Resources.makeCommittable(file, shell);
if (!status.isOK()) {
return;
}
if (fPrevious) {
String errorTitle= CompareMessages.ReplaceFromHistory_title;
String errorMessage= CompareMessages.ReplaceFromHistory_internalErrorMessage;
try {
ITypedElement ti = ElementLocalHistoryPageSource.getPreviousEdition(file, input);
if (ti == null) {
MessageDialog.openInformation(shell, errorTitle, CompareMessages.ReplaceFromHistory_parsingErrorMessage);
return;
}
replace(input, file, ti);
} catch (TeamException e) {
ExceptionHandler.handle(e, shell, errorTitle, errorMessage);
}
} else {
JavaElementHistoryPageSource pageSource = JavaElementHistoryPageSource.getInstance();
CompareConfiguration cc = new CompareConfiguration();
cc.setLeftEditable(false);
cc.setRightEditable(false);
HistoryPageCompareEditorInput ci = new HistoryPageCompareEditorInput(cc, pageSource, input) {
@Override
protected void performReplace(Object selectedElement) {
if (selectedElement instanceof ITypedElement) {
JavaReplaceWithEditionActionImpl.this.replace(input, file, (ITypedElement)selectedElement);
}
}
};
ci.setReplace(true);
ci.setTitle(CompareMessages.JavaReplaceWithEditionActionImpl_0);
ci.setHelpContextId(IJavaHelpContextIds.REPLACE_ELEMENT_WITH_HISTORY_DIALOG);
CompareUI.openCompareDialog(ci);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:55,代码来源:JavaReplaceWithEditionActionImpl.java