本文整理汇总了Java中org.eclipse.core.resources.IResource.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java IResource.getParent方法的具体用法?Java IResource.getParent怎么用?Java IResource.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.resources.IResource
的用法示例。
在下文中一共展示了IResource.getParent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tryCreateName
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
public void tryCreateName ()
{
// Try and get the resource selection to determine a current directory for the file dialog.
//
if ( this.selection != null && !this.selection.isEmpty () )
{
// Get the resource...
//
final Object selectedElement = this.selection.iterator ().next ();
if ( selectedElement instanceof IResource )
{
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if ( selectedResource.getType () == IResource.FILE )
{
selectedResource = selectedResource.getParent ();
}
// This gives us a directory...
//
if ( selectedResource instanceof IFolder || selectedResource instanceof IProject )
{
// Set this for the container.
//
this.newFileCreationPage.setContainerFullPath ( selectedResource.getFullPath () );
// Make up a unique new name here.
//
String modelFilename = this.base + "." + this.extension; //$NON-NLS-1$
for ( int i = 1; ( (IContainer)selectedResource ).findMember ( modelFilename ) != null; ++i )
{
modelFilename = this.base + i + "." + this.extension; //$NON-NLS-1$
}
this.newFileCreationPage.setFileName ( modelFilename );
}
}
}
}
示例2: createRule
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* Returns the scheduling rule to use when creating the resource at the
* given container path. The rule should be the creation rule for the
* top-most non-existing parent.
*
* @param resource
* The resource being created
* @return The scheduling rule for creating the given resource
* @since 3.1
* @deprecated As of 3.3, scheduling rules are provided by the undoable
* operation that this page creates and executes.
*/
protected ISchedulingRule createRule(IResource resource) {
IResource parent = resource.getParent();
while (parent != null) {
if (parent.exists()) {
return resource.getWorkspace().getRuleFactory()
.createRule(resource);
}
resource = parent;
parent = parent.getParent();
}
return resource.getWorkspace().getRoot();
}
示例3: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void addPages() {
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new SrmModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(SrmEditorPlugin.INSTANCE.getString("_UI_SrmModelWizard_label"));
newFileCreationPage.setDescription(SrmEditorPlugin.INSTANCE.getString("_UI_SrmModelWizard_description"));
newFileCreationPage.setFileName(SrmEditorPlugin.INSTANCE.getString("_UI_SrmEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
//
if (selection != null && !selection.isEmpty()) {
// Get the resource...
//
Object selectedElement = selection.iterator().next();
if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
// This gives us a directory...
//
if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
// Set this for the container.
//
newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
// Make up a unique new name here.
//
String defaultModelBaseFilename = SrmEditorPlugin.INSTANCE.getString("_UI_SrmEditorFilenameDefaultBase");
String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
}
newFileCreationPage.setFileName(modelFilename);
}
}
}
initialObjectCreationPage = new SrmModelWizardInitialObjectCreationPage("Whatever2");
initialObjectCreationPage.setTitle(SrmEditorPlugin.INSTANCE.getString("_UI_SrmModelWizard_label"));
initialObjectCreationPage.setDescription(SrmEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
addPage(initialObjectCreationPage);
}
示例4: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void addPages() {
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new MetamodelModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(MetamodelEditorPlugin.INSTANCE.getString("_UI_MetamodelModelWizard_label"));
newFileCreationPage.setDescription(MetamodelEditorPlugin.INSTANCE.getString("_UI_MetamodelModelWizard_description"));
newFileCreationPage.setFileName(MetamodelEditorPlugin.INSTANCE.getString("_UI_MetamodelEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
//
if (selection != null && !selection.isEmpty()) {
// Get the resource...
//
Object selectedElement = selection.iterator().next();
if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
// This gives us a directory...
//
if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
// Set this for the container.
//
newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
// Make up a unique new name here.
//
String defaultModelBaseFilename = MetamodelEditorPlugin.INSTANCE.getString("_UI_MetamodelEditorFilenameDefaultBase");
String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
}
newFileCreationPage.setFileName(modelFilename);
}
}
}
initialObjectCreationPage = new MetamodelModelWizardInitialObjectCreationPage("Whatever2");
initialObjectCreationPage.setTitle(MetamodelEditorPlugin.INSTANCE.getString("_UI_MetamodelModelWizard_label"));
initialObjectCreationPage.setDescription(MetamodelEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
addPage(initialObjectCreationPage);
}
示例5: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void addPages() {
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new LibraryModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(LibraryEditorPlugin.INSTANCE.getString("_UI_LibraryModelWizard_label"));
newFileCreationPage.setDescription(LibraryEditorPlugin.INSTANCE.getString("_UI_LibraryModelWizard_description"));
newFileCreationPage.setFileName(LibraryEditorPlugin.INSTANCE.getString("_UI_LibraryEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
//
if (selection != null && !selection.isEmpty()) {
// Get the resource...
//
Object selectedElement = selection.iterator().next();
if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
// This gives us a directory...
//
if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
// Set this for the container.
//
newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
// Make up a unique new name here.
//
String defaultModelBaseFilename = LibraryEditorPlugin.INSTANCE.getString("_UI_LibraryEditorFilenameDefaultBase");
String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
}
newFileCreationPage.setFileName(modelFilename);
}
}
}
initialObjectCreationPage = new LibraryModelWizardInitialObjectCreationPage("Whatever2");
initialObjectCreationPage.setTitle(LibraryEditorPlugin.INSTANCE.getString("_UI_LibraryModelWizard_label"));
initialObjectCreationPage.setDescription(LibraryEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
addPage(initialObjectCreationPage);
}
示例6: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void addPages ()
{
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new ProtocolModelWizardNewFileCreationPage ( "Whatever", selection ); //$NON-NLS-1$
newFileCreationPage.setTitle ( NextGenerationProtocolEditorPlugin.INSTANCE.getString ( "_UI_ProtocolModelWizard_label" ) ); //$NON-NLS-1$
newFileCreationPage.setDescription ( NextGenerationProtocolEditorPlugin.INSTANCE.getString ( "_UI_ProtocolModelWizard_description" ) ); //$NON-NLS-1$
newFileCreationPage.setFileName ( NextGenerationProtocolEditorPlugin.INSTANCE.getString ( "_UI_ProtocolEditorFilenameDefaultBase" ) + "." + FILE_EXTENSIONS.get ( 0 ) ); //$NON-NLS-1$ //$NON-NLS-2$
addPage ( newFileCreationPage );
// Try and get the resource selection to determine a current directory for the file dialog.
//
if ( selection != null && !selection.isEmpty () )
{
// Get the resource...
//
Object selectedElement = selection.iterator ().next ();
if ( selectedElement instanceof IResource )
{
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if ( selectedResource.getType () == IResource.FILE )
{
selectedResource = selectedResource.getParent ();
}
// This gives us a directory...
//
if ( selectedResource instanceof IFolder || selectedResource instanceof IProject )
{
// Set this for the container.
//
newFileCreationPage.setContainerFullPath ( selectedResource.getFullPath () );
// Make up a unique new name here.
//
String defaultModelBaseFilename = NextGenerationProtocolEditorPlugin.INSTANCE.getString ( "_UI_ProtocolEditorFilenameDefaultBase" ); //$NON-NLS-1$
String defaultModelFilenameExtension = FILE_EXTENSIONS.get ( 0 );
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$
for ( int i = 1; ( (IContainer)selectedResource ).findMember ( modelFilename ) != null; ++i )
{
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$
}
newFileCreationPage.setFileName ( modelFilename );
}
}
}
initialObjectCreationPage = new ProtocolModelWizardInitialObjectCreationPage ( "Whatever2" ); //$NON-NLS-1$
initialObjectCreationPage.setTitle ( NextGenerationProtocolEditorPlugin.INSTANCE.getString ( "_UI_ProtocolModelWizard_label" ) ); //$NON-NLS-1$
initialObjectCreationPage.setDescription ( NextGenerationProtocolEditorPlugin.INSTANCE.getString ( "_UI_Wizard_initial_object_description" ) ); //$NON-NLS-1$
addPage ( initialObjectCreationPage );
}
示例7: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void addPages() {
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new OCCIModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(OCCIEditorPlugin.INSTANCE.getString("_UI_OCCIModelWizard_label"));
newFileCreationPage.setDescription(OCCIEditorPlugin.INSTANCE.getString("_UI_OCCIModelWizard_description"));
newFileCreationPage.setFileName(OCCIEditorPlugin.INSTANCE.getString("_UI_OCCIEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
//
if (selection != null && !selection.isEmpty()) {
// Get the resource...
//
Object selectedElement = selection.iterator().next();
if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
// This gives us a directory...
//
if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
// Set this for the container.
//
newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
// Make up a unique new name here.
//
String defaultModelBaseFilename = OCCIEditorPlugin.INSTANCE.getString("_UI_OCCIEditorFilenameDefaultBase");
String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
}
newFileCreationPage.setFileName(modelFilename);
}
}
}
initialObjectCreationPage = new OCCIModelWizardInitialObjectCreationPage("Whatever2");
initialObjectCreationPage.setTitle(OCCIEditorPlugin.INSTANCE.getString("_UI_OCCIModelWizard_label"));
initialObjectCreationPage.setDescription(OCCIEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
addPage(initialObjectCreationPage);
}
示例8: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void addPages() {
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new MonitoringModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(MonitoringEditorPlugin.INSTANCE.getString("_UI_MonitoringModelWizard_label"));
newFileCreationPage.setDescription(MonitoringEditorPlugin.INSTANCE.getString("_UI_MonitoringModelWizard_description"));
newFileCreationPage.setFileName(MonitoringEditorPlugin.INSTANCE.getString("_UI_MonitoringEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
//
if (selection != null && !selection.isEmpty()) {
// Get the resource...
//
Object selectedElement = selection.iterator().next();
if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
// This gives us a directory...
//
if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
// Set this for the container.
//
newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
// Make up a unique new name here.
//
String defaultModelBaseFilename = MonitoringEditorPlugin.INSTANCE.getString("_UI_MonitoringEditorFilenameDefaultBase");
String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
}
newFileCreationPage.setFileName(modelFilename);
}
}
}
initialObjectCreationPage = new MonitoringModelWizardInitialObjectCreationPage("Whatever2");
initialObjectCreationPage.setTitle(MonitoringEditorPlugin.INSTANCE.getString("_UI_MonitoringModelWizard_label"));
initialObjectCreationPage.setDescription(MonitoringEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
addPage(initialObjectCreationPage);
}
示例9: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void addPages() {
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new Time4sysModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(Time4sysEditorPlugin.INSTANCE.getString("_UI_Time4sysModelWizard_label"));
newFileCreationPage.setDescription(Time4sysEditorPlugin.INSTANCE.getString("_UI_Time4sysModelWizard_description"));
newFileCreationPage.setFileName(Time4sysEditorPlugin.INSTANCE.getString("_UI_Time4sysEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
//
if (selection != null && !selection.isEmpty()) {
// Get the resource...
//
Object selectedElement = selection.iterator().next();
if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
// This gives us a directory...
//
if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
// Set this for the container.
//
newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
// Make up a unique new name here.
//
String defaultModelBaseFilename = Time4sysEditorPlugin.INSTANCE.getString("_UI_Time4sysEditorFilenameDefaultBase");
String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
}
newFileCreationPage.setFileName(modelFilename);
}
}
}
initialObjectCreationPage = new Time4sysModelWizardInitialObjectCreationPage("Whatever2");
initialObjectCreationPage.setTitle(Time4sysEditorPlugin.INSTANCE.getString("_UI_Time4sysModelWizard_label"));
initialObjectCreationPage.setDescription(Time4sysEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
addPage(initialObjectCreationPage);
}
示例10: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void addPages() {
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new GexpressionsModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(GexpressionsEditorPlugin.INSTANCE.getString("_UI_GexpressionsModelWizard_label"));
newFileCreationPage.setDescription(GexpressionsEditorPlugin.INSTANCE.getString("_UI_GexpressionsModelWizard_description"));
newFileCreationPage.setFileName(GexpressionsEditorPlugin.INSTANCE.getString("_UI_GexpressionsEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
//
if (selection != null && !selection.isEmpty()) {
// Get the resource...
//
Object selectedElement = selection.iterator().next();
if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
// This gives us a directory...
//
if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
// Set this for the container.
//
newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
// Make up a unique new name here.
//
String defaultModelBaseFilename = GexpressionsEditorPlugin.INSTANCE.getString("_UI_GexpressionsEditorFilenameDefaultBase");
String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
}
newFileCreationPage.setFileName(modelFilename);
}
}
}
initialObjectCreationPage = new GexpressionsModelWizardInitialObjectCreationPage("Whatever2");
initialObjectCreationPage.setTitle(GexpressionsEditorPlugin.INSTANCE.getString("_UI_GexpressionsModelWizard_label"));
initialObjectCreationPage.setDescription(GexpressionsEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
addPage(initialObjectCreationPage);
}
示例11: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void addPages ()
{
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new ProfileModelWizardNewFileCreationPage ( "Whatever", selection ); //$NON-NLS-1$
newFileCreationPage.setTitle ( WorldEditorPlugin.INSTANCE.getString ( "_UI_ProfileModelWizard_label" ) ); //$NON-NLS-1$
newFileCreationPage.setDescription ( WorldEditorPlugin.INSTANCE.getString ( "_UI_ProfileModelWizard_description" ) ); //$NON-NLS-1$
newFileCreationPage.setFileName ( WorldEditorPlugin.INSTANCE.getString ( "_UI_ProfileEditorFilenameDefaultBase" ) + "." + FILE_EXTENSIONS.get ( 0 ) ); //$NON-NLS-1$ //$NON-NLS-2$
addPage ( newFileCreationPage );
// Try and get the resource selection to determine a current directory for the file dialog.
//
if ( selection != null && !selection.isEmpty () )
{
// Get the resource...
//
Object selectedElement = selection.iterator ().next ();
if ( selectedElement instanceof IResource )
{
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if ( selectedResource.getType () == IResource.FILE )
{
selectedResource = selectedResource.getParent ();
}
// This gives us a directory...
//
if ( selectedResource instanceof IFolder || selectedResource instanceof IProject )
{
// Set this for the container.
//
newFileCreationPage.setContainerFullPath ( selectedResource.getFullPath () );
// Make up a unique new name here.
//
String defaultModelBaseFilename = WorldEditorPlugin.INSTANCE.getString ( "_UI_ProfileEditorFilenameDefaultBase" ); //$NON-NLS-1$
String defaultModelFilenameExtension = FILE_EXTENSIONS.get ( 0 );
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$
for ( int i = 1; ( (IContainer)selectedResource ).findMember ( modelFilename ) != null; ++i )
{
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$
}
newFileCreationPage.setFileName ( modelFilename );
}
}
}
initialObjectCreationPage = new ProfileModelWizardInitialObjectCreationPage ( "Whatever2" ); //$NON-NLS-1$
initialObjectCreationPage.setTitle ( WorldEditorPlugin.INSTANCE.getString ( "_UI_ProfileModelWizard_label" ) ); //$NON-NLS-1$
initialObjectCreationPage.setDescription ( WorldEditorPlugin.INSTANCE.getString ( "_UI_Wizard_initial_object_description" ) ); //$NON-NLS-1$
addPage ( initialObjectCreationPage );
}
示例12: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void addPages ()
{
// Create a page, set the title, and the initial model file name.
//
this.newFileCreationPage = new ConfigurationModelWizardNewFileCreationPage ( "Whatever", this.selection ); //$NON-NLS-1$
this.newFileCreationPage.setTitle ( WorldEditorPlugin.INSTANCE.getString ( "_UI_ConfigurationModelWizard_label" ) ); //$NON-NLS-1$
this.newFileCreationPage.setDescription ( WorldEditorPlugin.INSTANCE.getString ( "_UI_ConfigurationModelWizard_description" ) ); //$NON-NLS-1$
this.newFileCreationPage.setFileName ( WorldEditorPlugin.INSTANCE.getString ( "_UI_ConfigurationEditorFilenameDefaultBase" ) + "." + FILE_EXTENSIONS.get ( 0 ) ); //$NON-NLS-1$ //$NON-NLS-2$
addPage ( this.newFileCreationPage );
// Try and get the resource selection to determine a current directory for the file dialog.
//
if ( this.selection != null && !this.selection.isEmpty () )
{
// Get the resource...
//
Object selectedElement = this.selection.iterator ().next ();
if ( selectedElement instanceof IResource )
{
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if ( selectedResource.getType () == IResource.FILE )
{
selectedResource = selectedResource.getParent ();
}
// This gives us a directory...
//
if ( selectedResource instanceof IFolder || selectedResource instanceof IProject )
{
// Set this for the container.
//
this.newFileCreationPage.setContainerFullPath ( selectedResource.getFullPath () );
// Make up a unique new name here.
//
String defaultModelBaseFilename = WorldEditorPlugin.INSTANCE.getString ( "_UI_ConfigurationEditorFilenameDefaultBase" ); //$NON-NLS-1$
String defaultModelFilenameExtension = FILE_EXTENSIONS.get ( 0 );
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$
for ( int i = 1; ( (IContainer)selectedResource ).findMember ( modelFilename ) != null; ++i )
{
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$
}
this.newFileCreationPage.setFileName ( modelFilename );
}
}
}
this.initialObjectCreationPage = new ConfigurationModelWizardInitialObjectCreationPage ( "Whatever2" ); //$NON-NLS-1$
this.initialObjectCreationPage.setTitle ( WorldEditorPlugin.INSTANCE.getString ( "_UI_ConfigurationModelWizard_label" ) ); //$NON-NLS-1$
this.initialObjectCreationPage.setDescription ( WorldEditorPlugin.INSTANCE.getString ( "_UI_Wizard_initial_object_description" ) ); //$NON-NLS-1$
addPage ( this.initialObjectCreationPage );
}
示例13: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void addPages ()
{
// Create a page, set the title, and the initial model file name.
//
this.newFileCreationPage = new MemoryModelWizardNewFileCreationPage ( "Whatever", this.selection ); //$NON-NLS-1$
this.newFileCreationPage.setTitle ( MemoryEditorPlugin.INSTANCE.getString ( "_UI_MemoryModelWizard_label" ) ); //$NON-NLS-1$
this.newFileCreationPage.setDescription ( MemoryEditorPlugin.INSTANCE.getString ( "_UI_MemoryModelWizard_description" ) ); //$NON-NLS-1$
this.newFileCreationPage.setFileName ( MemoryEditorPlugin.INSTANCE.getString ( "_UI_MemoryEditorFilenameDefaultBase" ) + "." + FILE_EXTENSIONS.get ( 0 ) ); //$NON-NLS-1$ //$NON-NLS-2$
addPage ( this.newFileCreationPage );
// Try and get the resource selection to determine a current directory for the file dialog.
//
if ( this.selection != null && !this.selection.isEmpty () )
{
// Get the resource...
//
final Object selectedElement = this.selection.iterator ().next ();
if ( selectedElement instanceof IResource )
{
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if ( selectedResource.getType () == IResource.FILE )
{
selectedResource = selectedResource.getParent ();
}
// This gives us a directory...
//
if ( selectedResource instanceof IFolder || selectedResource instanceof IProject )
{
// Set this for the container.
//
this.newFileCreationPage.setContainerFullPath ( selectedResource.getFullPath () );
// Make up a unique new name here.
//
final String defaultModelBaseFilename = MemoryEditorPlugin.INSTANCE.getString ( "_UI_MemoryEditorFilenameDefaultBase" ); //$NON-NLS-1$
final String defaultModelFilenameExtension = FILE_EXTENSIONS.get ( 0 );
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$
for ( int i = 1; ( (IContainer)selectedResource ).findMember ( modelFilename ) != null; ++i )
{
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$
}
this.newFileCreationPage.setFileName ( modelFilename );
}
}
}
this.initialObjectCreationPage = new MemoryModelWizardInitialObjectCreationPage ( "Whatever2" ); //$NON-NLS-1$
this.initialObjectCreationPage.setTitle ( MemoryEditorPlugin.INSTANCE.getString ( "_UI_MemoryModelWizard_label" ) ); //$NON-NLS-1$
this.initialObjectCreationPage.setDescription ( MemoryEditorPlugin.INSTANCE.getString ( "_UI_Wizard_initial_object_description" ) ); //$NON-NLS-1$
addPage ( this.initialObjectCreationPage );
}
示例14: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void addPages ()
{
// Create a page, set the title, and the initial model file name.
//
this.newFileCreationPage = new RecipeModelWizardNewFileCreationPage ( "Whatever", this.selection ); //$NON-NLS-1$
this.newFileCreationPage.setTitle ( RecipeEditorPlugin.INSTANCE.getString ( "_UI_RecipeModelWizard_label" ) ); //$NON-NLS-1$
this.newFileCreationPage.setDescription ( RecipeEditorPlugin.INSTANCE.getString ( "_UI_RecipeModelWizard_description" ) ); //$NON-NLS-1$
this.newFileCreationPage.setFileName ( RecipeEditorPlugin.INSTANCE.getString ( "_UI_RecipeEditorFilenameDefaultBase" ) + "." + FILE_EXTENSIONS.get ( 0 ) ); //$NON-NLS-1$ //$NON-NLS-2$
addPage ( this.newFileCreationPage );
// Try and get the resource selection to determine a current directory for the file dialog.
//
if ( this.selection != null && !this.selection.isEmpty () )
{
// Get the resource...
//
final Object selectedElement = this.selection.iterator ().next ();
if ( selectedElement instanceof IResource )
{
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if ( selectedResource.getType () == IResource.FILE )
{
selectedResource = selectedResource.getParent ();
}
// This gives us a directory...
//
if ( selectedResource instanceof IFolder || selectedResource instanceof IProject )
{
// Set this for the container.
//
this.newFileCreationPage.setContainerFullPath ( selectedResource.getFullPath () );
// Make up a unique new name here.
//
final String defaultModelBaseFilename = RecipeEditorPlugin.INSTANCE.getString ( "_UI_RecipeEditorFilenameDefaultBase" ); //$NON-NLS-1$
final String defaultModelFilenameExtension = FILE_EXTENSIONS.get ( 0 );
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$
for ( int i = 1; ( (IContainer)selectedResource ).findMember ( modelFilename ) != null; ++i )
{
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$
}
this.newFileCreationPage.setFileName ( modelFilename );
}
}
}
this.initialObjectCreationPage = new RecipeModelWizardInitialObjectCreationPage ( "Whatever2" ); //$NON-NLS-1$
this.initialObjectCreationPage.setTitle ( RecipeEditorPlugin.INSTANCE.getString ( "_UI_RecipeModelWizard_label" ) ); //$NON-NLS-1$
this.initialObjectCreationPage.setDescription ( RecipeEditorPlugin.INSTANCE.getString ( "_UI_Wizard_initial_object_description" ) ); //$NON-NLS-1$
addPage ( this.initialObjectCreationPage );
}
示例15: addPages
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void addPages() {
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new FsmModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(FsmEditorPlugin.INSTANCE.getString("_UI_FsmModelWizard_label"));
newFileCreationPage.setDescription(FsmEditorPlugin.INSTANCE.getString("_UI_FsmModelWizard_description"));
newFileCreationPage.setFileName(FsmEditorPlugin.INSTANCE.getString("_UI_FsmEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
//
if (selection != null && !selection.isEmpty()) {
// Get the resource...
//
Object selectedElement = selection.iterator().next();
if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
// This gives us a directory...
//
if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
// Set this for the container.
//
newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
// Make up a unique new name here.
//
String defaultModelBaseFilename = FsmEditorPlugin.INSTANCE.getString("_UI_FsmEditorFilenameDefaultBase");
String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
}
newFileCreationPage.setFileName(modelFilename);
}
}
}
initialObjectCreationPage = new FsmModelWizardInitialObjectCreationPage("Whatever2");
initialObjectCreationPage.setTitle(FsmEditorPlugin.INSTANCE.getString("_UI_FsmModelWizard_label"));
initialObjectCreationPage.setDescription(FsmEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
addPage(initialObjectCreationPage);
}