public void setJspFolder( String folder ) { webContentPath_ = (new Path(folder)).removeLastSegments(1); webContent_ = ResourceUtils.findResource(webContentPath_); sampleFolderBrowseButton_.setEnabled(webContent_ != null); jspFolderText_.setText( folder ); }
private boolean containsNode(Properties props, IPath path) { if (props == null) return false; for (Enumeration<?> e = props.keys(); e.hasMoreElements();) { String fullKey = (String) e.nextElement(); if (props.getProperty(fullKey) == null) continue; // remove last segment which stands for key IPath nodePath = new Path(fullKey).removeLastSegments(1); if (path.isPrefixOf(nodePath)) return true; } return false; }
PlatformConfiguration(URL url) throws Exception { URL installLocation = Utils.getInstallURL(); // Retrieve install location with respect to given url if possible try { if (url != null && url.getProtocol().equals("file") && url.getPath().endsWith("configuration/org.eclipse.update/platform.xml")) { installLocation = new Path(url.getPath()).removeLastSegments(3).toFile().toURL(); } } catch (Exception e) { // } initialize(url, installLocation); }
protected void load(Properties properties, String style, StyleContext context) { if (style == null) return; try { URL styleURL = new URL(style); try (InputStream is = styleURL.openStream()) { properties.load(is); } context.path = new Path(style).removeLastSegments(1); String t = (String)properties.get("theme"); //$NON-NLS-1$ if (t!=null && t.trim().equalsIgnoreCase("true")) //$NON-NLS-1$ context.inTheme = true; } catch (Exception e) { Log.error("Could not load SWT style: " + style, e); //$NON-NLS-1$ } }
public static File fromOSGiJarToOSGiInstallArea(String path) { IPath parentFolder = new Path(path).removeLastSegments(1); if ("plugins".equalsIgnoreCase(parentFolder.lastSegment())) //$NON-NLS-1$ return parentFolder.removeLastSegments(1).toFile(); return parentFolder.toFile(); }
public static File fromOSGiJarToOSGiInstallArea(String path) { IPath parentFolder = new Path(path).removeLastSegments(1); if ("plugins".equalsIgnoreCase(parentFolder.lastSegment())) //$NON-NLS-1$ return parentFolder.removeLastSegments(1).toFile(); return parentFolder.toFile(); }
private static File fromOSGiJarToOSGiInstallArea(String path) { IPath parentFolder = new Path(path).removeLastSegments(1); if (parentFolder.lastSegment().equals("plugins")) //$NON-NLS-1$ return parentFolder.removeLastSegments(1).toFile(); return parentFolder.toFile(); }
private static File fromOSGiJarToOSGiInstallArea(String path) { IPath parentFolder = new Path(path).removeLastSegments(1); if (parentFolder.lastSegment().equals("plugins")) //$NON-NLS-1$ return parentFolder.removeLastSegments(1).toFile(); return parentFolder.toFile(); }
private static String uriToHost(URI location) { // if URI is not opaque, just getting the host may be enough String host = location.getHost(); if (host == null) { String scheme = location.getScheme(); if (URIUtil.isFileURI(location) || scheme == null) // If the URI references a file, a password could possibly be needed for the directory // (it could be a protected zip file representing a compressed directory) - in this // case the key is the path without the last segment. // Using "Path" this way may result in an empty string - which later will result in // an invalid key. host = new Path(location.toString()).removeLastSegments(1).toString(); else // it is an opaque URI - details are unknown - can only use entire string. host = location.toString(); } return host; }
protected String getDestination() { if (fArchiveFileButton.getSelection()) { String path = fArchiveCombo.getText(); if (path.length() > 0) { path = new Path(path).removeLastSegments(1).toOSString(); return new File(path).getAbsolutePath(); } return ""; //$NON-NLS-1$ } File dir = new File(fDirectoryCombo.getText().trim()); return dir.getAbsolutePath(); }
protected String getDestination() { if (fArchiveFileButton.getSelection()) { String path = fArchiveCombo.getText(); if (path.length() > 0) { path = new Path(path).removeLastSegments(1).toOSString(); return new File(path).getAbsolutePath(); } return ""; //$NON-NLS-1$ } File dir = new File(fDirectoryCombo.getText().trim()); return dir.getAbsolutePath(); }
private static String uriToHost(URI location) { // if URI is not opaque, just getting the host may be enough String host = location.getHost(); if (host == null) { String scheme = location.getScheme(); if (URIUtil.isFileURI(location) || scheme == null) // If the URI references a file, a password could possibly be needed for the directory // (it could be a protected zip file representing a compressed directory) - in this // case the key is the path without the last segment. // Using "Path" this way may result in an empty string - which later will result in // an invalid key. host = new Path(location.toString()).removeLastSegments(1).toString(); else // it is an opaque URI - details are unknown - can only use entire string. host = location.toString(); } return host; }
protected String getDestination() { if (fArchiveFileButton.getSelection()) { String path = fArchiveCombo.getText(); if (path.length() > 0) { path = new Path(path).removeLastSegments(1).toOSString(); return new File(path).getAbsolutePath(); } return ""; //$NON-NLS-1$ } if (fInstallButton.getSelection()) { File dir = new File(fInstallCombo.getText().trim()); return dir.getAbsolutePath(); } File dir = new File(fDirectoryCombo.getText().trim()); return dir.getAbsolutePath(); }
public IPath removeFileExtension() { String extension = getFileExtension(); if (extension == null || extension.equals("")) { //$NON-NLS-1$ return this; } String lastSegment = lastSegment(); int index = lastSegment.lastIndexOf(extension) - 1; return removeLastSegments(1).append(lastSegment.substring(0, index)); }
public IPath removeFileExtension() { String extension = getFileExtension(); if (extension == null || extension.equals("")) { //$NON-NLS-1$ return this; } String lastSegment = lastSegment(); int index = lastSegment.lastIndexOf(extension) - 1; return removeLastSegments(1).append(lastSegment.substring(0, index)); }
@Override public IPath removeFileExtension() { String extension = getFileExtension(); if (extension == null || extension.equals("")) { //$NON-NLS-1$ return this; } String lastSegment = lastSegment(); int index = lastSegment.lastIndexOf(extension) - 1; return removeLastSegments(1).append(lastSegment.substring(0, index)); }
@Override public IPath removeFileExtension() { String extension = getFileExtension(); if (extension == null || extension.equals("")) { //$NON-NLS-1$ return this; } String lastSegment = lastSegment(); int index = lastSegment.lastIndexOf(extension) - 1; return removeLastSegments(1).append(lastSegment.substring(0, index)); }
protected void generateAntBuildFile(String filename) { String parent = new Path(filename).removeLastSegments(1).toOSString(); String buildFilename = new Path(filename).lastSegment(); if (!buildFilename.endsWith(".xml")) //$NON-NLS-1$ buildFilename += ".xml"; //$NON-NLS-1$ File dir = new File(new File(parent).getAbsolutePath()); if (!dir.exists()) dir.mkdirs(); try { Document task = generateAntTask(); if (task != null) { File buildFile = new File(dir, buildFilename); XMLPrintHandler.writeFile(task, buildFile); generateAntTask(); setDefaultValues(dir, buildFilename); } } catch (IOException e) { } }
/** * Creates a new project creation wizard page. * * @param path * the path to a directory in the local file system */ public GitCreateGeneralProjectPage(String path) { super(GitCreateGeneralProjectPage.class.getName()); myDirectory = new File(path); setPageComplete(false); setTitle(UIText.WizardProjectsImportPage_ImportProjectsTitle); setDescription(UIText.WizardProjectsImportPage_ImportProjectsDescription); // check for default location: is workspace location parent of path? IPath parent = new Path(path).removeLastSegments(1); if(ResourcesPlugin.getWorkspace().getRoot().getLocation().equals(parent)) defaultLocation = true; else defaultLocation = false; }
protected void assertCreateRequirements(IProjectDescription description) throws CoreException { checkDoesNotExist(); checkDescription(this, description, false); URI location = description.getLocationURI(); if (location != null) return; //if the project is in the default location, need to check for collision with existing folder of different case if (!Workspace.caseSensitive) { IFileStore store = getStore(); IFileInfo localInfo = store.fetchInfo(); if (localInfo.exists()) { String name = getLocalManager().getLocalName(store); if (name != null && !store.getName().equals(name)) { String msg = NLS.bind(Messages.resources_existsLocalDifferentCase, new Path(store.toString()).removeLastSegments(1).append(name).toOSString()); throw new ResourceException(IResourceStatus.CASE_VARIANT_EXISTS, getFullPath(), msg, null); } } } }