Skip to content
Snippets Groups Projects
Commit e8bbd162 authored by Jürgen Walter's avatar Jürgen Walter
Browse files

improved wizard

parent 9bad1ff4
No related branches found
No related tags found
No related merge requests found
......@@ -5,15 +5,15 @@
<extension
point="org.eclipse.ui.importWizards">
<category
name="Kieker2PCM"
name="PMX"
id="tools.descartes.pmx.frontend.pcm.importWizards.sampleCategory">
</category>
<!--TODO add proper icons -->
<wizard
name="Import PCM Project from Kieker Traces"
name="Palladio Component Model Projects from Kieker Traces"
icon="icons/sample.gif"
category="tools.descartes.pmx.frontend.pcm.importWizards.sampleCategory"
class="tools.descartes.pmx.frontend.pcm.importWizards.ImportPCMWizard"
class="tools.descartes.pmx.frontend.pcm.importWizards.PMXImportWizard"
id="tools.descartes.pmx.frontend.pcm.importWizards.ImportPCMWizard">
<description>
Import a PCM project into the workspace.
......
tools.descartes.pmx.frontend.pcm/pmx_logo.png

29.5 KiB

......@@ -52,13 +52,15 @@ public class ImportPCMWizardPage extends WizardNewFileCreationPage {
public ImportPCMWizardPage(String pageName, IStructuredSelection selection) {
super(pageName, selection);
setTitle(pageName); //NON-NLS-1
setDescription("Imports a project with Palladio Component Model into the workspace"); //NON-NLS-1
setDescription("Imports a project containing a Palladio Component Model into the workspace"); //NON-NLS-1
}
/* (non-Javadoc)
* @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#createAdvancedControls(org.eclipse.swt.widgets.Composite)
*/
protected void createAdvancedControls(Composite parent) {
// ContainerSelectionDialog x = new ContainerSelectionDialog(getShell(), null, true, "message ABC X");
Composite fileSelectionArea = new Composite(parent, SWT.NONE);
GridData fileSelectionData = new GridData(GridData.GRAB_HORIZONTAL
| GridData.FILL_HORIZONTAL);
......@@ -78,7 +80,8 @@ public class ImportPCMWizardPage extends WizardNewFileCreationPage {
setFileName(path.lastSegment());
}
});
String[] extensions = new String[] { "*.zip;*.tar;*.jar" }; //NON-NLS-1
//String[] extensions = new String[] { "*.zip;*.tar;*.jar" }; //NON-NLS-1
String[] extensions = null; //NON-NLS-1
editor.setFileExtensions(extensions);
fileSelectionArea.moveAbove(null);
......
/**
* ==============================================
* PMX : Performance Model eXtractor
* ==============================================
*
* (c) Copyright 2014-2015, by Juergen Walter and Contributors.
*
* Project Info: http://descartes.tools/pmx
*
* All rights reserved. This software is made available under the terms of the
* Eclipse Public License (EPL) v1.0 as published by the Eclipse Foundation
* http://www.eclipse.org/legal/epl-v10.html
*
* This software is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the Eclipse Public License (EPL)
* for more details.
*
* You should have received a copy of the Eclipse Public License (EPL)
* along with this software; if not visit http://www.eclipse.org or write to
* Eclipse Foundation, Inc., 308 SW First Avenue, Suite 110, Portland, 97204 USA
* Email: license (at) eclipse.org
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*/
package tools.descartes.pmx.frontend.pcm.importWizards;
import java.io.File;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class InputSelctionWizardPage extends WizardPage {
public static Text inputDirectory;
Display display = Display.getDefault();
Label label1;
Label label2;
Label label3;
public InputSelctionWizardPage() {
super("Enter Trace Location Information");
setTitle("Enter Trace Location Information");
setDescription("Define the directory of the Kieker monitoring logs you want to extract a performance model from.");
}
@Override
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
composite.setLayout(layout);
layout.numColumns = 1;
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
label1 = new Label(composite, GridData.FILL_HORIZONTAL);
label1.setText("Enter inputDirectory to Kieker files here:");
// label2 = new Label(composite, GridData.FILL_HORIZONTAL);
// Image logo_image = new Image(display,"C:\\Users\\Jrgen\\git\\pmx\\tools.descartes.pmx.frontend.pcm"+File.separatorChar+"pmx_logo.png");
// label2.setImage(logo_image);
inputDirectory = new Text(composite, SWT.BORDER | SWT.SINGLE);
label3 = new Label(composite, SWT.NONE);
label3.setText("waiting for input ...");
label3.setLayoutData(gd);
inputDirectory.setLayoutData(gd);
inputDirectory.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
if (!inputDirectory.getText().isEmpty()) {
if ((new File(inputDirectory.getText())).isDirectory()){
label3.setText("input is a directory ...");
OutputSelectionWizard.setOutputDirectory(inputDirectory.getText() + File.separatorChar+"pcm"+File.separatorChar);
setPageComplete(true);
}else{
label3.setText("input is no directory ...");
setPageComplete(false);
}
}else{
setPageComplete(false);
}
}
});
inputDirectory.setText("");
inputDirectory.setText("C:\\Users\\Jrgen\\git\\pmx\\tools.descartes.pmx.console\\console\\kieker-20141103-190203561-UTC-j2eeservice-KIEKER-TEST");
// required to avoid an error in the system
setControl(composite);
setPageComplete(false);
}
public static String getInputDirectory() {
return inputDirectory.getText();
}
}
package tools.descartes.pmx.frontend.pcm.importWizards;
import java.io.File;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
public class OutputSelectionWizard extends WizardPage {
private Text outputDirectory;
private Composite container;
private static OutputSelectionWizard singleton = new OutputSelectionWizard();
public static OutputSelectionWizard getSingleton(){
return singleton;
}
private OutputSelectionWizard() {
super("Enter Output Information");
setTitle("Enter Output Information");
setDescription("Select the output directory.");
setControl(outputDirectory);
//String initialPath
//outputDirectory.setText(initialPath);
}
@Override
public void createControl(Composite parent) {
container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
container.setLayout(layout);
layout.numColumns = 2;
Label label1 = new Label(container, SWT.NONE);
label1.setText("Output path");
outputDirectory = new Text(container, SWT.BORDER | SWT.SINGLE);
outputDirectory.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
if (!outputDirectory.getText().isEmpty()) {
setPageComplete(true);
}else{
setPageComplete(false);
}
}
});
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
outputDirectory.setLayoutData(gd);
// required to avoid an error in the system
setControl(container);
setPageComplete(false);
}
public static void setOutputDirectory(String dir) {
(new File(dir)).mkdirs();
singleton.outputDirectory.setText(dir);
//outputDirectory.getListeners(0).setPageComplete(true);
singleton.setPageComplete(true);
}
public static String getOutputDirectory() {
return singleton.outputDirectory.toString();
}
}
\ No newline at end of file
......@@ -26,36 +26,30 @@
*/
package tools.descartes.pmx.frontend.pcm.importWizards;
import java.io.File;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.ui.IImportWizard;
import org.eclipse.ui.IWorkbench;
public class ImportPCMWizard extends Wizard implements IImportWizard {
ImportPCMWizardPage mainPage;
import tools.descartes.pmx.console.PMXCommandLine;
public ImportPCMWizard() {
public class PMXImportWizard extends Wizard implements IImportWizard {
WizardPage outputPage, inputPage;
public PMXImportWizard() {
super();
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
public boolean performFinish() {
// IFile file = mainPage.createNewFile();
// if (file == null)
// return false;
return true;
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
*/
public void init(IWorkbench workbench, IStructuredSelection selection) {
setWindowTitle("PCM Import Wizard"); //NON-NLS-1
setWindowTitle("PMX Import Wizard"); //NON-NLS-1
setNeedsProgressMonitor(true);
mainPage = new ImportPCMWizardPage("Palladio Component Model from Kieker Monitoring log file",selection); //NON-NLS-1
inputPage = new InputSelctionWizardPage();
outputPage = OutputSelectionWizard.getSingleton();
}
/* (non-Javadoc)
......@@ -63,7 +57,24 @@ public class ImportPCMWizard extends Wizard implements IImportWizard {
*/
public void addPages() {
super.addPages();
addPage(mainPage);
addPage(inputPage);
addPage(outputPage);
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
public boolean performFinish() {
String outputDirectory;
if(null != OutputSelectionWizard.getOutputDirectory()){
outputDirectory = OutputSelectionWizard.getOutputDirectory();
}else{
outputDirectory = InputSelctionWizardPage.getInputDirectory()+File.separatorChar+"pcm"+File.separatorChar;
}
String[] args = {"-i", InputSelctionWizardPage.inputDirectory.getText(), "-o", outputDirectory};
PMXCommandLine.run(args);
System.out.println("finished wizard");
System.out.println("results available in " + outputDirectory);
return true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment