public void selectionChanged(IStructuredSelection selection) { setEnabled(canEnable(selection)); }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the Java editor */ public FindBrokenNLSKeysAction(JavaEditor editor) { this(editor.getEditorSite()); fEditor= editor; setEnabled(getCompilationUnit(editor) != null); }
public FindBrokenNLSKeysAction(IWorkbenchSite site) { super(site); setText(ActionMessages.FindNLSProblemsAction_Name); setToolTipText(ActionMessages.FindNLSProblemsAction_ToolTip); setDescription(ActionMessages.FindNLSProblemsAction_Description); }
@Override public void run(IStructuredSelection selection) { if (selection.size() == 1) { Object firstElement= selection.getFirstElement(); if (firstElement instanceof IJavaElement) { IJavaElement javaElement= (IJavaElement) firstElement; if (!ActionUtil.isProcessable(getShell(), javaElement)) { return; } } } SearchPatternData[] data= getNLSFiles(selection); if (data == null || data.length == 0) { MessageDialog.openInformation(getShell(), ActionMessages.FindNLSProblemsAction_ErrorDialogTitle, ActionMessages.FindNLSProblemsAction_NoPropertieFilesFoundErrorDescription); return; } String scope= "workspace"; //$NON-NLS-1$ if (selection.size() == 1) { Object firstElement= selection.getFirstElement(); if (firstElement instanceof IJavaElement) { scope= ((IJavaElement)firstElement).getElementName(); } else if (firstElement instanceof IFile) { scope= ((IFile)firstElement).getName(); } else if (firstElement instanceof IFolder) { scope= ((IFolder)firstElement).getName(); } } run(data, scope); }
fExternalizeStrings.setActionDefinitionId(IJavaEditorActionDefinitionIds.EXTERNALIZE_STRINGS); fFindNLSProblems= new FindBrokenNLSKeysAction(site); fFindNLSProblems.setActionDefinitionId(FindBrokenNLSKeysAction.FIND_BROKEN_NLS_KEYS_ACTION_ID); fAddJavaDocStub.update(selection); fExternalizeStrings.update(selection); fFindNLSProblems.update(selection); fCleanUp.update(selection); fAddTaskAction.update(selection);
@Override public void selectionChanged(ITextSelection selection) { ISelectionProvider selectionProvider= fEditor.getSelectionProvider(); if (selectionProvider == null) { setEnabled(false); } else { selectionChanged(new StructuredSelection(selectionProvider.getSelection())); } }
@Override public void run(ITextSelection selection) { ISelectionProvider selectionProvider= fEditor.getSelectionProvider(); if (selectionProvider == null) return; run(new StructuredSelection(selectionProvider.getSelection())); }
if (firstElement instanceof IJavaElement) { IJavaElement javaElement= (IJavaElement) firstElement; if (!ActionUtil.isProcessable(getShell(), javaElement)) { return; SearchPatternData[] data= getNLSFiles(selection); if (data == null || data.length == 0) { MessageDialog.openInformation(getShell(), ActionMessages.FindNLSProblemsAction_ErrorDialogTitle, ActionMessages.FindNLSProblemsAction_NoPropertieFilesFoundErrorDescription); return; run(data, scope);
fExternalizeStrings.setActionDefinitionId(IJavaEditorActionDefinitionIds.EXTERNALIZE_STRINGS); fFindNLSProblems= new FindBrokenNLSKeysAction(site); fFindNLSProblems.setActionDefinitionId(FindBrokenNLSKeysAction.FIND_BROKEN_NLS_KEYS_ACTION_ID); fAddJavaDocStub.update(selection); fExternalizeStrings.update(selection); fFindNLSProblems.update(selection); fCleanUp.update(selection); fAddTaskAction.update(selection);
public void selectionChanged(ITextSelection selection) { ISelectionProvider selectionProvider= fEditor.getSelectionProvider(); if (selectionProvider == null) { setEnabled(false); } else { selectionChanged(new StructuredSelection(selectionProvider.getSelection())); } }
public void run(ITextSelection selection) { ISelectionProvider selectionProvider= fEditor.getSelectionProvider(); if (selectionProvider == null) return; run(new StructuredSelection(selectionProvider.getSelection())); }
public FindBrokenNLSKeysAction(IWorkbenchSite site) { super(site); setText(ActionMessages.FindNLSProblemsAction_Name); setToolTipText(ActionMessages.FindNLSProblemsAction_ToolTip); setDescription(ActionMessages.FindNLSProblemsAction_Description); }
@Override public void run(IStructuredSelection selection) { if (selection.size() == 1) { Object firstElement= selection.getFirstElement(); if (firstElement instanceof IJavaElement) { IJavaElement javaElement= (IJavaElement) firstElement; if (!ActionUtil.isProcessable(getShell(), javaElement)) { return; } } } SearchPatternData[] data= getNLSFiles(selection); if (data == null || data.length == 0) { MessageDialog.openInformation(getShell(), ActionMessages.FindNLSProblemsAction_ErrorDialogTitle, ActionMessages.FindNLSProblemsAction_NoPropertieFilesFoundErrorDescription); return; } String scope= "workspace"; //$NON-NLS-1$ if (selection.size() == 1) { Object firstElement= selection.getFirstElement(); if (firstElement instanceof IJavaElement) { scope= ((IJavaElement)firstElement).getElementName(); } else if (firstElement instanceof IFile) { scope= ((IFile)firstElement).getName(); } else if (firstElement instanceof IFolder) { scope= ((IFolder)firstElement).getName(); } } run(data, scope); }
fExternalizeStrings.setActionDefinitionId(IJavaEditorActionDefinitionIds.EXTERNALIZE_STRINGS); fFindNLSProblems= new FindBrokenNLSKeysAction(site); fFindNLSProblems.setActionDefinitionId(FindBrokenNLSKeysAction.FIND_BROKEN_NLS_KEYS_ACTION_ID); fAddJavaDocStub.update(selection); fExternalizeStrings.update(selection); fFindNLSProblems.update(selection); fCleanUp.update(selection); fAddTaskAction.update(selection);
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the Java editor */ public FindBrokenNLSKeysAction(JavaEditor editor) { this(editor.getEditorSite()); fEditor= editor; setEnabled(getCompilationUnit(editor) != null); }
@Override public void selectionChanged(IStructuredSelection selection) { setEnabled(canEnable(selection)); }
@Override public void selectionChanged(ITextSelection selection) { ISelectionProvider selectionProvider= fEditor.getSelectionProvider(); if (selectionProvider == null) { setEnabled(false); } else { selectionChanged(new StructuredSelection(selectionProvider.getSelection())); } }
@Override public void run(ITextSelection selection) { ISelectionProvider selectionProvider= fEditor.getSelectionProvider(); if (selectionProvider == null) return; run(new StructuredSelection(selectionProvider.getSelection())); }
public FindBrokenNLSKeysAction(IWorkbenchSite site) { super(site); setText(ActionMessages.FindNLSProblemsAction_Name); setToolTipText(ActionMessages.FindNLSProblemsAction_ToolTip); setDescription(ActionMessages.FindNLSProblemsAction_Description); }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * @param editor the Java editor */ public FindBrokenNLSKeysAction(JavaEditor editor) { this(editor.getEditorSite()); fEditor= editor; setEnabled(getCompilationUnit(editor) != null); }