public static IResource getFirstResource(ISelection selection) { IResource[] resources = getResources(selection); if (resources.length > 0) return resources[0]; return null; }
public static IResource getFirstResource(ISelection selection) { IResource[] resources = getResources(selection); if (resources.length > 0) return resources[0]; return null; }
protected boolean isEnabled(ISelection selection) { return Utilities.getResources(selection).length == 1; }
protected boolean isEnabled(ISelection selection) { return Utilities.getResources(selection).length == 1; }
@Override protected boolean isEnabled(ISelection selection) { return Utilities.getResources(selection).length == 1; }
private String getWorkspacePath() { if (fTreeViewer != null){ IResource[] resources= Utilities.getResources(fTreeViewer.getSelection()); if (resources.length > 0) { IResource patchFile= resources[0]; return patchFile.getFullPath().toString(); } } return ""; //$NON-NLS-1$ }
private String getWorkspacePath() { if (fTreeViewer != null){ IResource[] resources= Utilities.getResources(fTreeViewer.getSelection()); if (resources.length > 0) { IResource patchFile= resources[0]; return patchFile.getFullPath().toString(); } } return ""; //$NON-NLS-1$ }
public boolean isEnabled(ISelection s) { IResource[] selection= Utilities.getResources(s); if (selection.length < 2 || selection.length > 3) return false; boolean threeWay= selection.length == 3; if (threeWay) // It only makes sense if they're all mutually comparable. // If not, the user should compare two of them. return comparable(selection[0], selection[1]) && comparable(selection[0], selection[2]) && comparable(selection[1], selection[2]); return comparable(selection[0], selection[1]); }
public boolean isEnabled(ISelection s) { IResource[] selection= Utilities.getResources(s); if (selection.length < 2 || selection.length > 3) return false; boolean threeWay= selection.length == 3; if (threeWay) // It only makes sense if they're all mutually comparable. // If not, the user should compare two of them. return comparable(selection[0], selection[1]) && comparable(selection[0], selection[2]) && comparable(selection[1], selection[2]); return comparable(selection[0], selection[1]); }
IResource[] resources= Utilities.getResources(fTreeViewer.getSelection()); if (resources != null && resources.length > 0) { IResource patchFile= resources[0];
IResource[] resources= Utilities.getResources(fTreeViewer.getSelection()); if (resources != null && resources.length > 0) { IResource patchFile= resources[0];
boolean setSelection(ISelection s, Shell shell) { IResource[] selection= Utilities.getResources(s); fThreeWay= selection.length == 3; if (fThreeWay) { SelectAncestorDialog dialog = new SelectAncestorDialog(shell, selection); int code = dialog.open(); if (code == Window.CANCEL) return false; fAncestorResource= dialog.ancestorResource; fAncestor= getStructure(fAncestorResource); fLeftResource= dialog.leftResource; fRightResource= dialog.rightResource; } else { fAncestorResource= null; fAncestor= null; fLeftResource= selection[0]; fRightResource= selection[1]; } fLeft= getStructure(fLeftResource); fRight= getStructure(fRightResource); return true; }
boolean setSelection(ISelection s, Shell shell, boolean showSelectAncestorDialog) { if (!showSelectAncestorDialog) return showCompareWithOtherResourceDialog(shell, s); IResource[] selection= Utilities.getResources(s); fThreeWay= selection.length == 3; if (fThreeWay) { SelectAncestorDialog dialog = new SelectAncestorDialog(shell, selection); int code = dialog.open(); if (code != Window.OK) return false; fAncestorResource= dialog.ancestorResource; fAncestor= getStructure(fAncestorResource); fLeftResource= dialog.leftResource; fRightResource= dialog.rightResource; } else { fAncestorResource= null; fAncestor= null; fLeftResource= selection[0]; fRightResource= selection[1]; } fLeft= getStructure(fLeftResource); fRight= getStructure(fRightResource); return true; }
AddFromHistoryDialog dialog= null; Object[] s= Utilities.getResources(selection);
private void setSelection(ISelection selection) { IResource[] selectedResources = Utilities.getResources(selection); switch (selectedResources.length) { case 1: leftPanel.workspaceContent.setResource(selectedResources[0]); break; case 2: leftPanel.workspaceContent.setResource(selectedResources[0]); rightPanel.workspaceContent.setResource(selectedResources[1]); break; case 3: ancestorPanel.workspaceContent.setResource(selectedResources[0]); ancestorPanel.expandable.setExpanded(true); leftPanel.workspaceContent.setResource(selectedResources[1]); rightPanel.workspaceContent.setResource(selectedResources[2]); break; default: break; } setInitialContentTypes(); }
} else if (inputMethod==WORKSPACE) { IResource[] resources= Utilities.getResources(fTreeViewer.getSelection()); IResource patchFile= resources[0]; if (patchFile != null) {
} else if (inputMethod==WORKSPACE) { IResource[] resources= Utilities.getResources(fTreeViewer.getSelection()); IResource patchFile= resources[0]; if (patchFile != null) {
AddFromHistoryDialog dialog= null; Object[] s= Utilities.getResources(selection);