private SelectionDispatchAction getCopyQualifiedNameAction() { if (fCopyQualifiedNameAction == null) { fCopyQualifiedNameAction= new CopyQualifiedNameAction(getSite()); } return fCopyQualifiedNameAction; }
/** * {@inheritDoc} */ public void selectionChanged(IStructuredSelection selection) { setEnabled(canEnable(selection.toArray())); }
private Object[] getSelectedElements() { if (fEditor != null) { Object element= getSelectedElement(fEditor); if (element == null) return null; return new Object[] { element }; } ISelection selection= getSelection(); if (!(selection instanceof IStructuredSelection)) return null; List<Object> result= new ArrayList<>(); for (Iterator<?> iter= ((IStructuredSelection)selection).iterator(); iter.hasNext();) { Object element= iter.next(); if (isValidElement(element)) result.add(element); } if (result.isEmpty()) return null; return result.toArray(new Object[result.size()]); }
public CopyQualifiedNameAction(IWorkbenchSite site) { super(site); setText(ActionMessages.CopyQualifiedNameAction_ActionName); setToolTipText(ActionMessages.CopyQualifiedNameAction_ToolTipText); setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_COPY_QUALIFIED_NAME); setImageDescriptor(JavaPluginImages.DESC_ELCL_COPY_QUALIFIED_NAME); }
private IJavaElement[] getSelectedElements() throws JavaModelException { if (fEditor != null) { IJavaElement element= getSelectedElement(fEditor); if (element == null) return null; return new IJavaElement[] {element}; } ISelection selection= getSelection(); if (!(selection instanceof IStructuredSelection)) return null; List result= new ArrayList(); for (Iterator iter= ((IStructuredSelection)selection).iterator(); iter.hasNext();) { Object element= iter.next(); if (isValideElement(element)) result.add(element); } if (result.isEmpty()) return null; return (IJavaElement[])result.toArray(new IJavaElement[result.size()]); }
Object[] elements= getSelectedElements(); if (elements == null) { MessageDialog.openInformation(getShell(), ActionMessages.CopyQualifiedNameAction_InfoDialogTitel, ActionMessages.CopyQualifiedNameAction_NoElementToQualify); return; String qualifiedName= getQualifiedName(element); IResource resource= null; if (element instanceof IJavaElement) { buf.append(getQualifiedName(elements[0])); for (int i= 1; i < elements.length; i++) { String qualifiedName= getQualifiedName(elements[i]); buf.append(System.getProperty("line.separator")).append(qualifiedName); //$NON-NLS-1$ Clipboard clipboard= new Clipboard(getShell().getDisplay()); try { clipboard.setContents(data, dataTypes); throw e; if (MessageDialog.openQuestion(getShell(), ActionMessages.CopyQualifiedNameAction_ErrorTitle, ActionMessages.CopyQualifiedNameAction_ErrorDescription)) { clipboard.setContents(data, dataTypes);
public void run() { IJavaElement[] elements= getSelectedElements(); if (elements == null) { MessageDialog.openInformation(getShell(), ActionMessages.CopyQualifiedNameAction_InfoDialogTitel, ActionMessages.CopyQualifiedNameAction_NoElementToQualify); return; Clipboard clipboard= new Clipboard(getShell().getDisplay()); try { clipboard.setContents(data, dataTypes); throw e; if (MessageDialog.openQuestion(getShell(), ActionMessages.CopyQualifiedNameAction_ErrorTitle, ActionMessages.CopyQualifiedNameAction_ErrorDescription)) { clipboard.setContents(data, dataTypes);
public CopyQualifiedNameAction(JavaEditor editor) { this(editor.getSite()); fEditor= editor; setEnabled(true); }
public CopyQualifiedNameAction(IWorkbenchSite site) { super(site); setText(ActionMessages.CopyQualifiedNameAction_ActionName); setToolTipText(ActionMessages.CopyQualifiedNameAction_ToolTipText); setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_COPY_QUALIFIED_NAME); setImageDescriptor(JavaPluginImages.DESC_ELCL_COPY_QUALIFIED_NAME); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.COPY_QUALIFIED_NAME_ACTION); }
Object[] elements= getSelectedElements(); if (elements == null) { MessageDialog.openInformation(getShell(), ActionMessages.CopyQualifiedNameAction_InfoDialogTitel, ActionMessages.CopyQualifiedNameAction_NoElementToQualify); return; String qualifiedName= getQualifiedName(element); IResource resource= null; if (element instanceof IJavaElement) { buf.append(getQualifiedName(elements[0])); for (int i= 1; i < elements.length; i++) { String qualifiedName= getQualifiedName(elements[i]); buf.append(System.getProperty("line.separator")).append(qualifiedName); //$NON-NLS-1$ Clipboard clipboard= new Clipboard(getShell().getDisplay()); try { clipboard.setContents(data, dataTypes); throw e; if (MessageDialog.openQuestion(getShell(), ActionMessages.CopyQualifiedNameAction_ErrorTitle, ActionMessages.CopyQualifiedNameAction_ErrorDescription)) { clipboard.setContents(data, dataTypes);
public CopyQualifiedNameAction(JavaEditor editor) { this(editor.getSite()); fEditor= editor; setEnabled(true); }
public CopyQualifiedNameAction(IWorkbenchSite site) { super(site); setText(ActionMessages.CopyQualifiedNameAction_ActionName); setToolTipText(ActionMessages.CopyQualifiedNameAction_ToolTipText); setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_COPY_QUALIFIED_NAME); setImageDescriptor(JavaPluginImages.DESC_ELCL_COPY_QUALIFIED_NAME); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.COPY_QUALIFIED_NAME_ACTION); }
private Object[] getSelectedElements() { if (fEditor != null) { Object element= getSelectedElement(fEditor); if (element == null) return null; return new Object[] { element }; } ISelection selection= getSelection(); if (!(selection instanceof IStructuredSelection)) return null; List<Object> result= new ArrayList<>(); for (Iterator<?> iter= ((IStructuredSelection)selection).iterator(); iter.hasNext();) { Object element= iter.next(); if (isValidElement(element)) result.add(element); } if (result.isEmpty()) return null; return result.toArray(new Object[result.size()]); }
@Override public void selectionChanged(IStructuredSelection selection) { setEnabled(canEnable(selection.toArray())); }
private SelectionDispatchAction getCopyQualifiedNameAction() { if (fCopyQualifiedNameAction == null) { fCopyQualifiedNameAction= new CopyQualifiedNameAction(getSite()); fCopyQualifiedNameAction.setActionDefinitionId(CopyQualifiedNameAction.ACTION_DEFINITION_ID); } return fCopyQualifiedNameAction; }
public CopyQualifiedNameAction(JavaEditor editor) { this(editor.getSite()); fEditor= editor; setEnabled(true); }
@Override public void selectionChanged(IStructuredSelection selection) { setEnabled(canEnable(selection.toArray())); }
private SelectionDispatchAction getCopyQualifiedNameAction() { if (fCopyQualifiedNameAction == null) { fCopyQualifiedNameAction= new CopyQualifiedNameAction(getSite()); fCopyQualifiedNameAction.setActionDefinitionId(CopyQualifiedNameAction.ACTION_DEFINITION_ID); } return fCopyQualifiedNameAction; }
private CCPActionGroup(IWorkbenchSite site) { fSite= site; fClipboard= new Clipboard(site.getShell().getDisplay()); fPasteAction= new PasteAction(fSite, fClipboard); fPasteAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.PASTE); fCopyAction= new CopyToClipboardAction(fSite, fClipboard); fCopyAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY); fCopyQualifiedNameAction= new CopyQualifiedNameAction(fSite); fCopyQualifiedNameAction.setActionDefinitionId(CopyQualifiedNameAction.ACTION_DEFINITION_ID); fCutAction= new CutAction(fSite, fClipboard); fCutAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.CUT); fDeleteAction= new DeleteAction(fSite); fDeleteAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE); fActions= new SelectionDispatchAction[] { fCutAction, fCopyAction, fCopyQualifiedNameAction, fPasteAction, fDeleteAction }; registerActionsAsSelectionChangeListeners(); }
fCopyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY); fCopyQualifiedNameAction= new CopyQualifiedNameAction(site); fCopyQualifiedNameAction.setActionDefinitionId(CopyQualifiedNameAction.ACTION_DEFINITION_ID);