summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorNeil Guzman2013-08-07 11:37:36 (EDT)
committer Roland Grunberg2013-08-09 10:24:17 (EDT)
commit81e1945f0719cd2935b41ffb401ab3d60d029853 (patch)
tree6635796afd032df302c5812ad5433df9c368b4f0
parent99be9f313c0005b5b6d5f9a42ba78f979abfb193 (diff)
downloadorg.eclipse.linuxtools-81e1945f0719cd2935b41ffb401ab3d60d029853.zip
org.eclipse.linuxtools-81e1945f0719cd2935b41ffb401ab3d60d029853.tar.gz
org.eclipse.linuxtools-81e1945f0719cd2935b41ffb401ab3d60d029853.tar.bz2
RPMStubby: Stub specfile in proper dir B#414589refs/changes/17/15217/6
When stubbing out a new RPM specfile, it will be created in the proper folder. If it is an RPMBuild layout it will place it into the SPECS folder, else it will be placed into the base directory. Change-Id: Ie71f11cdb148059bc70e66c8d45869a6b419763f Signed-off-by: Neil Guzman <nguzman@redhat.com> Reviewed-on: https://git.eclipse.org/r/15217 Reviewed-by: Roland Grunberg <rgrunber@redhat.com> IP-Clean: Roland Grunberg <rgrunber@redhat.com> Tested-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/AbstractGenerator.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/AbstractGenerator.java b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/AbstractGenerator.java
index 3690e78..e194d00 100644
--- a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/AbstractGenerator.java
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/AbstractGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Red Hat, Inc.
+ * Copyright (c) 2012, 2013 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,7 @@ import java.io.InputStream;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -54,7 +55,12 @@ public abstract class AbstractGenerator {
StubbyLog.logError(new CoreException(status));
}
IContainer container = (IContainer) resource;
- final IFile file = container.getFile(new Path(specfileName));
+ IResource specsFolder = container.getProject().findMember("SPECS"); //$NON-NLS-1$
+ IFile file = container.getFile(new Path(specfileName));
+ if (specsFolder != null) {
+ file = ((IFolder) specsFolder).getFile(new Path(specfileName));
+ }
+ final IFile openFile = file;
try {
InputStream stream = contentInputStream;
if (file.exists()) {
@@ -73,7 +79,7 @@ public abstract class AbstractGenerator {
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
try {
- IDE.openEditor(page, file, true);
+ IDE.openEditor(page, openFile, true);
} catch (PartInitException e) {
StubbyLog.logError(e);
}