List of usage examples for org.eclipse.jface.util Util replaceAll
public static String replaceAll(String src, String find, String replacement)
String#replaceAll(String, String), but without support for regular expressions. From source file:com.liferay.ide.server.ui.util.ServerUIUtil.java
License:Open Source License
public static String getSystemExplorerCommand(File file) throws IOException { String retval = null;//from w ww . jav a 2 s .c o m String command = IDEWorkbenchPlugin.getDefault().getPreferenceStore() .getString(IDEInternalPreferences.WORKBENCH_SYSTEM_EXPLORER); if (!CoreUtil.isNullOrEmpty(command)) { command = Util.replaceAll(command, VARIABLE_RESOURCE, quotePath(file.getCanonicalPath())); command = Util.replaceAll(command, VARIABLE_RESOURCE_URI, file.getCanonicalFile().toURI().toString()); final File parent = file.getParentFile(); if (parent != null) { retval = Util.replaceAll(command, VARIABLE_FOLDER, quotePath(parent.getCanonicalPath())); } } return retval; }
From source file:ext.org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor.java
License:Open Source License
public IJavaElement getRefactoredJavaElement(IJavaElement original) { return new GenericRefactoringHandleTransplanter() { @Override/*w w w . j a v a 2 s. com*/ protected IPackageFragment transplantHandle(IPackageFragmentRoot parent, IPackageFragment element) { if (!fRenameSubpackages) { if (fPackage.equals(element)) return getNewPackage(); } else { String packName = element.getElementName(); String packageName = fPackage.getElementName(); if (fPackage.getParent().equals(parent) && packName.startsWith(packageName + '.')) { String newPackName = getNewElementName() + packName.substring(packageName.length() - 1); return getPackageFragmentRoot().getPackageFragment(newPackName); } } return super.transplantHandle(parent, element); } @Override protected IMethod transplantHandle(IType parent, IMethod element) { String[] parameterTypes = resolveParameterTypes(element); return parent.getMethod(element.getElementName(), parameterTypes); } private String[] resolveParameterTypes(IMethod method) { final String[] oldParameterTypes = method.getParameterTypes(); final String[] newparams = new String[oldParameterTypes.length]; final String[] possibleOldSigs = new String[2]; //using type signature, since there is no package signature possibleOldSigs[0] = Signature.createTypeSignature(fPackage.getElementName(), false); possibleOldSigs[1] = Signature.createTypeSignature(fPackage.getElementName(), true); final String[] possibleNewSigs = new String[2]; possibleNewSigs[0] = Signature.createTypeSignature(getNewElementName(), false); possibleNewSigs[1] = Signature.createTypeSignature(getNewElementName(), true); // Textually replace all occurrences // This handles stuff like Map<SomeClass, some.package.SomeClass> for (int i = 0; i < oldParameterTypes.length; i++) { newparams[i] = oldParameterTypes[i]; for (int j = 0; j < possibleOldSigs.length; j++) { newparams[i] = Util.replaceAll(newparams[i], possibleOldSigs[j], possibleNewSigs[j]); } } return newparams; } }.transplantHandle(original); }
From source file:org.eclipse.e4.ui.workbench.swt.internal.copy.SearchPattern.java
License:Open Source License
/** * Trims sequences of '*' characters/*from w w w. j a v a 2s . co m*/ * * @param pattern * string to be trimmed * @return trimmed pattern */ private String trimWildcardCharacters(String pattern) { return Util.replaceAll(pattern, "\\*+", "\\*"); //$NON-NLS-1$ //$NON-NLS-2$ } }
From source file:org.eclipse.linuxtools.internal.docker.ui.commands.ShowInSystemExplorerCommandHandler.java
License:Open Source License
/** * Prepare command for launching system explorer to show a path * * @param path// ww w .j a va 2 s. co m * the path to show * @return the command that shows the path * @see ShowInSystemExplorerHandler#getDefaultCommand() */ private String getShowInSystemExplorerCommand(final File path) { String command = ShowInSystemExplorerHandler.getDefaultCommand(); if ("".equals(command)) { Activator.logErrorMessage( CommandMessages.getString("command.showIn.systemExplorer.failure.command_unavailable")); return null; } try { command = Util.replaceAll(command, VARIABLE_RESOURCE, quotePath(path.getCanonicalPath())); command = Util.replaceAll(command, VARIABLE_RESOURCE_URI, path.getCanonicalFile().toURI().toString()); File parent = path.getParentFile(); if (parent != null) { command = Util.replaceAll(command, VARIABLE_FOLDER, quotePath(parent.getCanonicalPath())); } return command; } catch (IOException e) { Activator.logErrorMessage(CommandMessages.getString("command.showIn.systemExplorer.failure"), e); return null; } }
From source file:org.eclipse.ui.internal.ide.handlers.ShowInSystemExplorerHandler.java
License:Open Source License
/** * Prepare command for launching system explorer to show a path * * @param path/*from w w w . ja v a 2 s . c o m*/ * the path to show * @return the command that shows the path */ private String formShowInSytemExplorerCommand(File path) throws IOException { String command = IDEWorkbenchPlugin.getDefault().getPreferenceStore() .getString(IDEInternalPreferences.WORKBENCH_SYSTEM_EXPLORER); command = Util.replaceAll(command, VARIABLE_RESOURCE, quotePath(path.getCanonicalPath())); command = Util.replaceAll(command, VARIABLE_RESOURCE_URI, path.getCanonicalFile().toURI().toString()); File parent = path.getParentFile(); if (parent != null) { command = Util.replaceAll(command, VARIABLE_FOLDER, quotePath(parent.getCanonicalPath())); } return command; }
From source file:org.eclipsetrader.directa.internal.ui.StatusLineContributionItem.java
License:Open Source License
private String escape(String text) { return Util.replaceAll(text, "&", "&&"); //$NON-NLS-1$//$NON-NLS-2$ }