Java Code Examples for org.eclipse.core.resources.IResource.FILE

The following are Jave code examples for showing how to use FILE of the org.eclipse.core.resources.IResource class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Equella   File: JPFManifestBuilder.java   View Source Code Vote up 6 votes
@Override
public boolean visit(IResourceDelta delta) throws CoreException
{
	IResource resource = delta.getResource();
	if( resource.isDerived() )
	{
		return false;
	}
	if( resource.getType() == IResource.FILE )
	{
		IFile file = (IFile) resource;
		IProject project = resource.getProject();
		if( file.equals(JPFProject.getManifest(project)) )
		{
			manifestChanged = true;
			return false;
		}
	}
	return true;
}
 
Example 2
Project: n4js   File: LaunchConfigurationMainTab.java   View Source Code Vote up 5 votes
/***
 * Open a resource chooser to select a file
 **/
protected void browseFiles() {
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), root, IResource.FILE);
	dialog.setTitle("Search File");
	if (dialog.open() == Window.OK) {
		Object[] files = dialog.getResult();
		IFile file = (IFile) files[0];
		fileText.setText(file.getFullPath().toString());
	}

}
 
Example 3
Project: gw4e.project   File: GraphModelPropertyPage.java   View Source Code Vote up 5 votes
public Control createContents(Composite parent) {

		noDefaultAndApplyButton();
		Composite panel = createComposite(parent, 2);

		// PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),PROPERTY_PAGE_CONTEXT);

		IResource resource = (IResource) getElement();

		if (resource.getType() == IResource.FILE) {
			Label label = createLabel(panel, MessageUtil.getString("File_name")); //$NON-NLS-1$
			label = createLabel(panel, resource.getName());
			label.setData(GW4E_LABEL_ID,GW4E_LABEL_ID);
			fillExcessHorizontalSpace(label);

			//
			createLabel(panel, MessageUtil.getString("Path")); //$NON-NLS-1$
			label = createLabel(panel, resource.getFullPath().setDevice(null).toString());
			fillExcessHorizontalSpace(label);

			createLabel(panel, MessageUtil.getString("modified")); //$NON-NLS-1$
			IFile file = (IFile) resource;
			label = createLabel(panel, formatDate(new Date(file.getLocalTimeStamp())));
			fillExcessHorizontalSpace(label);

			createrequirementSection(panel, file);
			createMethodSection(panel, file);
		}
		return new Canvas(panel, 0);
	}
 
Example 4
Project: neoscada   File: AbstractNewFileWizard.java   View Source Code Vote up 5 votes
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 );
            }
        }
    }
}
 
Example 5
Project: time4sys   File: LibraryModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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);
}
 
Example 6
Project: n4js   File: N4JSAllContainersState.java   View Source Code Vote up 4 votes
private boolean n4mfFileHasBeenChanged(IResourceDelta delta) {
	return delta.getKind() == IResourceDelta.CHANGED
			&& delta.getResource().getType() == IResource.FILE
			&& IN4JSProject.N4MF_MANIFEST.equalsIgnoreCase(delta.getFullPath().lastSegment());
}
 
Example 7
Project: n4js   File: TesterLaunchConfigurationMainTab.java   View Source Code Vote up 4 votes
@Override
protected int getAcceptedResourceTypes() {
	return IResource.PROJECT | IResource.FOLDER | IResource.FILE;
}
 
Example 8
Project: neoscada   File: ComponentModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 ComponentModelWizardNewFileCreationPage ( "Whatever", selection ); //$NON-NLS-1$
    newFileCreationPage.setTitle ( ComponentEditorPlugin.INSTANCE.getString ( "_UI_ComponentModelWizard_label" ) ); //$NON-NLS-1$
    newFileCreationPage.setDescription ( ComponentEditorPlugin.INSTANCE.getString ( "_UI_ComponentModelWizard_description" ) ); //$NON-NLS-1$
    newFileCreationPage.setFileName ( ComponentEditorPlugin.INSTANCE.getString ( "_UI_ComponentEditorFilenameDefaultBase" ) + "." + 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 = ComponentEditorPlugin.INSTANCE.getString ( "_UI_ComponentEditorFilenameDefaultBase" ); //$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 ComponentModelWizardInitialObjectCreationPage ( "Whatever2" ); //$NON-NLS-1$
    initialObjectCreationPage.setTitle ( ComponentEditorPlugin.INSTANCE.getString ( "_UI_ComponentModelWizard_label" ) ); //$NON-NLS-1$
    initialObjectCreationPage.setDescription ( ComponentEditorPlugin.INSTANCE.getString ( "_UI_Wizard_initial_object_description" ) ); //$NON-NLS-1$
    addPage ( initialObjectCreationPage );
}
 
Example 9
Project: neoscada   File: RecipeModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 );
}
 
Example 10
Project: time4sys   File: GrmModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 GrmModelWizardNewFileCreationPage("Whatever", selection);
	newFileCreationPage.setTitle(GrmEditorPlugin.INSTANCE.getString("_UI_GrmModelWizard_label"));
	newFileCreationPage.setDescription(GrmEditorPlugin.INSTANCE.getString("_UI_GrmModelWizard_description"));
	newFileCreationPage.setFileName(GrmEditorPlugin.INSTANCE.getString("_UI_GrmEditorFilenameDefaultBase") + "." + 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 = GrmEditorPlugin.INSTANCE.getString("_UI_GrmEditorFilenameDefaultBase");
				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 GrmModelWizardInitialObjectCreationPage("Whatever2");
	initialObjectCreationPage.setTitle(GrmEditorPlugin.INSTANCE.getString("_UI_GrmModelWizard_label"));
	initialObjectCreationPage.setDescription(GrmEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
	addPage(initialObjectCreationPage);
}
 
Example 11
Project: gemoc-studio   File: SelectAnyIFileDialog.java   View Source Code Vote up 4 votes
public SelectAnyIFileDialog(Shell parentShell, IContainer container){
	super(parentShell, container, IResource.FILE);
}
 
Example 12
Project: time4sys   File: ConstraintsModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 ConstraintsModelWizardNewFileCreationPage("Whatever", selection);
	newFileCreationPage.setTitle(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsModelWizard_label"));
	newFileCreationPage.setDescription(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsModelWizard_description"));
	newFileCreationPage.setFileName(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsEditorFilenameDefaultBase") + "." + 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 = ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsEditorFilenameDefaultBase");
				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 ConstraintsModelWizardInitialObjectCreationPage("Whatever2");
	initialObjectCreationPage.setTitle(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsModelWizard_label"));
	initialObjectCreationPage.setDescription(ConstraintsEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
	addPage(initialObjectCreationPage);
}
 
Example 13
Project: OCCI-Studio   File: CrtpModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 CrtpModelWizardNewFileCreationPage("Whatever", selection);
	newFileCreationPage.setTitle(CrtpEditorPlugin.INSTANCE.getString("_UI_CrtpModelWizard_label"));
	newFileCreationPage.setDescription(CrtpEditorPlugin.INSTANCE.getString("_UI_CrtpModelWizard_description"));
	newFileCreationPage.setFileName(CrtpEditorPlugin.INSTANCE.getString("_UI_CrtpEditorFilenameDefaultBase") + "." + 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 = CrtpEditorPlugin.INSTANCE.getString("_UI_CrtpEditorFilenameDefaultBase");
				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 CrtpModelWizardInitialObjectCreationPage("Whatever2");
	initialObjectCreationPage.setTitle(CrtpEditorPlugin.INSTANCE.getString("_UI_CrtpModelWizard_label"));
	initialObjectCreationPage.setDescription(CrtpEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
	addPage(initialObjectCreationPage);
}
 
Example 14
Project: OCCI-Studio   File: SlaModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 SlaModelWizardNewFileCreationPage("Whatever", selection);
	newFileCreationPage.setTitle(SlaEditorPlugin.INSTANCE.getString("_UI_SlaModelWizard_label"));
	newFileCreationPage.setDescription(SlaEditorPlugin.INSTANCE.getString("_UI_SlaModelWizard_description"));
	newFileCreationPage.setFileName(SlaEditorPlugin.INSTANCE.getString("_UI_SlaEditorFilenameDefaultBase") + "." + 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 = SlaEditorPlugin.INSTANCE.getString("_UI_SlaEditorFilenameDefaultBase");
				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 SlaModelWizardInitialObjectCreationPage("Whatever2");
	initialObjectCreationPage.setTitle(SlaEditorPlugin.INSTANCE.getString("_UI_SlaModelWizard_label"));
	initialObjectCreationPage.setDescription(SlaEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
	addPage(initialObjectCreationPage);
}
 
Example 15
Project: neoscada   File: ProtocolModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 );
}
 
Example 16
Project: neoscada   File: GlobalizeModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 GlobalizeModelWizardNewFileCreationPage ( "Whatever", selection ); //$NON-NLS-1$
    newFileCreationPage.setTitle ( GlobalizeEditorPlugin.INSTANCE.getString ( "_UI_GlobalizeModelWizard_label" ) ); //$NON-NLS-1$
    newFileCreationPage.setDescription ( GlobalizeEditorPlugin.INSTANCE.getString ( "_UI_GlobalizeModelWizard_description" ) ); //$NON-NLS-1$
    newFileCreationPage.setFileName ( GlobalizeEditorPlugin.INSTANCE.getString ( "_UI_GlobalizeEditorFilenameDefaultBase" ) + "." + 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 = GlobalizeEditorPlugin.INSTANCE.getString ( "_UI_GlobalizeEditorFilenameDefaultBase" ); //$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 GlobalizeModelWizardInitialObjectCreationPage ( "Whatever2" ); //$NON-NLS-1$
    initialObjectCreationPage.setTitle ( GlobalizeEditorPlugin.INSTANCE.getString ( "_UI_GlobalizeModelWizard_label" ) ); //$NON-NLS-1$
    initialObjectCreationPage.setDescription ( GlobalizeEditorPlugin.INSTANCE.getString ( "_UI_Wizard_initial_object_description" ) ); //$NON-NLS-1$
    addPage ( initialObjectCreationPage );
}
 
Example 17
Project: neoscada   File: DetailViewModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 DetailViewModelWizardNewFileCreationPage ( "Whatever", selection ); //$NON-NLS-1$
    newFileCreationPage.setTitle ( DetailViewEditorPlugin.INSTANCE.getString ( "_UI_DetailViewModelWizard_label" ) ); //$NON-NLS-1$
    newFileCreationPage.setDescription ( DetailViewEditorPlugin.INSTANCE.getString ( "_UI_DetailViewModelWizard_description" ) ); //$NON-NLS-1$
    newFileCreationPage.setFileName ( DetailViewEditorPlugin.INSTANCE.getString ( "_UI_DetailViewEditorFilenameDefaultBase" ) + "." + 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 = DetailViewEditorPlugin.INSTANCE.getString ( "_UI_DetailViewEditorFilenameDefaultBase" ); //$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 DetailViewModelWizardInitialObjectCreationPage ( "Whatever2" ); //$NON-NLS-1$
    initialObjectCreationPage.setTitle ( DetailViewEditorPlugin.INSTANCE.getString ( "_UI_DetailViewModelWizard_label" ) ); //$NON-NLS-1$
    initialObjectCreationPage.setDescription ( DetailViewEditorPlugin.INSTANCE.getString ( "_UI_Wizard_initial_object_description" ) ); //$NON-NLS-1$
    addPage ( initialObjectCreationPage );
}
 
Example 18
Project: neoscada   File: VisualInterfaceModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 VisualInterfaceModelWizardNewFileCreationPage ( "Whatever", this.selection ); //$NON-NLS-1$
    this.newFileCreationPage.setTitle ( VisualInterfaceEditorPlugin.INSTANCE.getString ( "_UI_VisualInterfaceModelWizard_label" ) ); //$NON-NLS-1$
    this.newFileCreationPage.setDescription ( VisualInterfaceEditorPlugin.INSTANCE.getString ( "_UI_VisualInterfaceModelWizard_description" ) ); //$NON-NLS-1$
    this.newFileCreationPage.setFileName ( VisualInterfaceEditorPlugin.INSTANCE.getString ( "_UI_VisualInterfaceEditorFilenameDefaultBase" ) + "." + 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 = VisualInterfaceEditorPlugin.INSTANCE.getString ( "_UI_VisualInterfaceEditorFilenameDefaultBase" ); //$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 VisualInterfaceModelWizardInitialObjectCreationPage ( "Whatever2" ); //$NON-NLS-1$
    this.initialObjectCreationPage.setTitle ( VisualInterfaceEditorPlugin.INSTANCE.getString ( "_UI_VisualInterfaceModelWizard_label" ) ); //$NON-NLS-1$
    this.initialObjectCreationPage.setDescription ( VisualInterfaceEditorPlugin.INSTANCE.getString ( "_UI_Wizard_initial_object_description" ) ); //$NON-NLS-1$
    addPage ( this.initialObjectCreationPage );
}
 
Example 19
Project: neoscada   File: DeploymentModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 DeploymentModelWizardNewFileCreationPage ( "Whatever", selection ); //$NON-NLS-1$
    newFileCreationPage.setTitle ( WorldEditorPlugin.INSTANCE.getString ( "_UI_DeploymentModelWizard_label" ) ); //$NON-NLS-1$
    newFileCreationPage.setDescription ( WorldEditorPlugin.INSTANCE.getString ( "_UI_DeploymentModelWizard_description" ) ); //$NON-NLS-1$
    newFileCreationPage.setFileName ( WorldEditorPlugin.INSTANCE.getString ( "_UI_DeploymentEditorFilenameDefaultBase" ) + "." + 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_DeploymentEditorFilenameDefaultBase" ); //$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 DeploymentModelWizardInitialObjectCreationPage ( "Whatever2" ); //$NON-NLS-1$
    initialObjectCreationPage.setTitle ( WorldEditorPlugin.INSTANCE.getString ( "_UI_DeploymentModelWizard_label" ) ); //$NON-NLS-1$
    initialObjectCreationPage.setDescription ( WorldEditorPlugin.INSTANCE.getString ( "_UI_Wizard_initial_object_description" ) ); //$NON-NLS-1$
    addPage ( initialObjectCreationPage );
}
 
Example 20
Project: neoscada   File: ProfileModelWizard.java   View Source Code Vote up 4 votes
/**
 * 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 );
}