本文整理汇总了Java中org.eclipse.jface.text.ITextOperationTarget.STRIP_PREFIX属性的典型用法代码示例。如果您正苦于以下问题:Java ITextOperationTarget.STRIP_PREFIX属性的具体用法?Java ITextOperationTarget.STRIP_PREFIX怎么用?Java ITextOperationTarget.STRIP_PREFIX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jface.text.ITextOperationTarget
的用法示例。
在下文中一共展示了ITextOperationTarget.STRIP_PREFIX属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
/**
* Implementation of the <code>IAction</code> prototype. Checks if the selected
* lines are all commented or not and uncomments/comments them respectively.
*/
public void run()
{
if (fOperationTarget == null || fDocumentPartitioning == null || fPrefixesMap == null)
return;
ITextEditor editor = getTextEditor();
if (editor == null)
return;
if (!validateEditorInputState())
return;
final int operationCode;
if (isSelectionCommented(editor.getSelectionProvider().getSelection()))
operationCode = ITextOperationTarget.STRIP_PREFIX;
else
operationCode = ITextOperationTarget.PREFIX;
Shell shell = editor.getSite().getShell();
if (!fOperationTarget.canDoOperation(operationCode))
{
if (shell != null)
MessageDialog.openError(shell, TLAEditorMessages.getString("ToggleComment.error.title"),
TLAEditorMessages.getString("ToggleComment.error.message"));
return;
}
Display display = null;
if (shell != null && !shell.isDisposed())
display = shell.getDisplay();
BusyIndicator.showWhile(display, new Runnable() {
public void run()
{
fOperationTarget.doOperation(operationCode);
}
});
}
示例2: run
/**
* Implementation of the <code>IAction</code> prototype. Checks if the selected
* lines are all commented or not and uncomments/comments them respectively.
*/
@Override
public void run() {
if (fOperationTarget == null || fDocumentPartitioning == null || fPrefixesMap == null)
return;
ITextEditor editor= getTextEditor();
if (editor == null)
return;
if (!validateEditorInputState())
return;
final int operationCode;
if (isSelectionCommented(editor.getSelectionProvider().getSelection()))
operationCode= ITextOperationTarget.STRIP_PREFIX;
else
operationCode= ITextOperationTarget.PREFIX;
Shell shell= editor.getSite().getShell();
if (!fOperationTarget.canDoOperation(operationCode)) {
if (shell != null)
MessageDialog.openError(shell, Messages.ToggleSLCommentAction_0, Messages.ToggleSLCommentAction_1);
return;
}
Display display= null;
if (shell != null && !shell.isDisposed())
display= shell.getDisplay();
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
fOperationTarget.doOperation(operationCode);
}
});
}
示例3: run
/**
* Implementation of the <code>IAction</code> prototype. Checks if the
* selected lines are all commented or not and uncomments/comments them
* respectively.
*/
public void run()
{
if (fOperationTarget == null || fDocumentPartitioning == null || fPrefixesMap == null) return;
ITextEditor editor = getTextEditor();
if (editor == null) return;
if (!validateEditorInputState()) return;
final int operationCode;
if (isSelectionCommented(editor.getSelectionProvider().getSelection()))
operationCode = ITextOperationTarget.STRIP_PREFIX;
else
operationCode = ITextOperationTarget.PREFIX;
Shell shell = editor.getSite().getShell();
if (!fOperationTarget.canDoOperation(operationCode))
{
if (shell != null)
// MessageDialog.openError(shell,
// JavaEditorMessages.getString("ToggleComment.error.title"),
// JavaEditorMessages.getString("ToggleComment.error.message"));
// //$NON-NLS-1$ //$NON-NLS-2$
return;
}
Display display = null;
if (shell != null && !shell.isDisposed()) display = shell.getDisplay();
BusyIndicator.showWhile(display, new Runnable() {
public void run()
{
fOperationTarget.doOperation(operationCode);
}
});
}
示例4: run
/**
* Implementation of the <code>IAction</code> prototype. Checks if the selected
* lines are all commented or not and uncomments/comments them respectively.
*/
@Override
public void run() {
if (fOperationTarget == null || fDocumentPartitioning == null || fPrefixesMap == null)
return;
ITextEditor editor= getTextEditor();
if (editor == null)
return;
if (!validateEditorInputState())
return;
final int operationCode;
if (isSelectionCommented(editor.getSelectionProvider().getSelection()))
operationCode= ITextOperationTarget.STRIP_PREFIX;
else
operationCode= ITextOperationTarget.PREFIX;
Shell shell= editor.getSite().getShell();
if (!fOperationTarget.canDoOperation(operationCode)) {
if (shell != null)
MessageDialog.openError(shell, JavaEditorMessages.ToggleComment_error_title, JavaEditorMessages.ToggleComment_error_message);
return;
}
Display display= null;
if (shell != null && !shell.isDisposed())
display= shell.getDisplay();
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
fOperationTarget.doOperation(operationCode);
}
});
}
示例5: execute
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor editor = null;
if (editorPart instanceof de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor) {
editor = (de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor) editorPart;
operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
}
if (editor == null || operationTarget == null || document == null) {
return null;
}
prefixesMap = new LinkedHashMap<String, String[]>();
prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
ISelection currentSelection = editor.getSelectionProvider().getSelection();
final int operationCode;
if (isSelectionCommented(currentSelection)) {
operationCode = ITextOperationTarget.STRIP_PREFIX;
} else {
operationCode = ITextOperationTarget.PREFIX;
}
if (!operationTarget.canDoOperation(operationCode)) {
return null;
}
Shell shell = editorPart.getSite().getShell();
Display display = null;
if (shell != null && !shell.isDisposed()) {
display = shell.getDisplay();
}
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
operationTarget.doOperation(operationCode);
}
});
return null;
}
示例6: execute
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor editor = null;
if (editorPart instanceof eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor) {
editor = (eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor) editorPart;
operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
}
if (editor == null || operationTarget == null || document == null) {
return null;
}
prefixesMap = new LinkedHashMap<String, String[]>();
prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
ISelection currentSelection = editor.getSelectionProvider().getSelection();
final int operationCode;
if (isSelectionCommented(currentSelection)) {
operationCode = ITextOperationTarget.STRIP_PREFIX;
} else {
operationCode = ITextOperationTarget.PREFIX;
}
if (!operationTarget.canDoOperation(operationCode)) {
return null;
}
Shell shell = editorPart.getSite().getShell();
Display display = null;
if (shell != null && !shell.isDisposed()) {
display = shell.getDisplay();
}
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
operationTarget.doOperation(operationCode);
}
});
return null;
}
示例7: execute
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor editor = null;
if (editorPart instanceof eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor) {
editor = (eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor) editorPart;
operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
}
if (editor == null || operationTarget == null || document == null) {
return null;
}
prefixesMap = new LinkedHashMap<String, String[]>();
prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
ISelection currentSelection = editor.getSelectionProvider().getSelection();
final int operationCode;
if (isSelectionCommented(currentSelection)) {
operationCode = ITextOperationTarget.STRIP_PREFIX;
} else {
operationCode = ITextOperationTarget.PREFIX;
}
if (!operationTarget.canDoOperation(operationCode)) {
return null;
}
Shell shell = editorPart.getSite().getShell();
Display display = null;
if (shell != null && !shell.isDisposed()) {
display = shell.getDisplay();
}
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
operationTarget.doOperation(operationCode);
}
});
return null;
}
示例8: execute
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor editor = null;
if (editorPart instanceof eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor) {
editor = (eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor) editorPart;
operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
}
if (editor == null || operationTarget == null || document == null) {
return null;
}
prefixesMap = new LinkedHashMap<String, String[]>();
prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
ISelection currentSelection = editor.getSelectionProvider().getSelection();
final int operationCode;
if (isSelectionCommented(currentSelection)) {
operationCode = ITextOperationTarget.STRIP_PREFIX;
} else {
operationCode = ITextOperationTarget.PREFIX;
}
if (!operationTarget.canDoOperation(operationCode)) {
return null;
}
Shell shell = editorPart.getSite().getShell();
Display display = null;
if (shell != null && !shell.isDisposed()) {
display = shell.getDisplay();
}
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
operationTarget.doOperation(operationCode);
}
});
return null;
}
示例9: execute
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor editor = null;
if (editorPart instanceof eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor) {
editor = (eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor) editorPart;
operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
}
if (editor == null || operationTarget == null || document == null) {
return null;
}
prefixesMap = new LinkedHashMap<String, String[]>();
prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
ISelection currentSelection = editor.getSelectionProvider().getSelection();
final int operationCode;
if (isSelectionCommented(currentSelection)) {
operationCode = ITextOperationTarget.STRIP_PREFIX;
} else {
operationCode = ITextOperationTarget.PREFIX;
}
if (!operationTarget.canDoOperation(operationCode)) {
return null;
}
Shell shell = editorPart.getSite().getShell();
Display display = null;
if (shell != null && !shell.isDisposed()) {
display = shell.getDisplay();
}
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
operationTarget.doOperation(operationCode);
}
});
return null;
}
示例10: execute
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor editor = null;
if (editorPart instanceof eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor) {
editor = (eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor) editorPart;
operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
}
if (editor == null || operationTarget == null || document == null) {
return null;
}
prefixesMap = new LinkedHashMap<String, String[]>();
prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
ISelection currentSelection = editor.getSelectionProvider().getSelection();
final int operationCode;
if (isSelectionCommented(currentSelection)) {
operationCode = ITextOperationTarget.STRIP_PREFIX;
} else {
operationCode = ITextOperationTarget.PREFIX;
}
if (!operationTarget.canDoOperation(operationCode)) {
return null;
}
Shell shell = editorPart.getSite().getShell();
Display display = null;
if (shell != null && !shell.isDisposed()) {
display = shell.getDisplay();
}
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
operationTarget.doOperation(operationCode);
}
});
return null;
}
示例11: execute
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor editor = null;
if (editorPart instanceof eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor) {
editor = (eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor) editorPart;
operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
}
if (editor == null || operationTarget == null || document == null) {
return null;
}
prefixesMap = new LinkedHashMap<String, String[]>();
prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
ISelection currentSelection = editor.getSelectionProvider().getSelection();
final int operationCode;
if (isSelectionCommented(currentSelection)) {
operationCode = ITextOperationTarget.STRIP_PREFIX;
} else {
operationCode = ITextOperationTarget.PREFIX;
}
if (!operationTarget.canDoOperation(operationCode)) {
return null;
}
Shell shell = editorPart.getSite().getShell();
Display display = null;
if (shell != null && !shell.isDisposed()) {
display = shell.getDisplay();
}
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
operationTarget.doOperation(operationCode);
}
});
return null;
}