Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
VioletProductEclipsePlugin
  • Loading branch information
tms08012 committed Jun 7, 2012
1 parent bf0fbcc commit 0c7e01c
Show file tree
Hide file tree
Showing 29 changed files with 2,734 additions and 0 deletions.
17 changes: 17 additions & 0 deletions VioletProductEclipsePlugin/VioletProduct.eclipse-plugin/.classpath
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="trunk/src"/>
<classpathentry excluding="trunk/src/" kind="src" path=""/>
<classpathentry kind="lib" path="trunk/lib/com.horstmann.violet-2.0.0-SNAPSHOT.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/Users/tms08012/Documents/2012FallJars/com.horstmann.violet-0.21.1.jar"/>
<classpathentry kind="lib" path="C:/Users/tms08012/Documents/2012FallJars/com.horstmann.violet.plugin.classdiagram-1.0-20110219.222952-4.jar"/>
<classpathentry kind="lib" path="C:/Users/tms08012/Documents/2012FallJars/jface-3.0m8.jar"/>
<classpathentry kind="lib" path="C:/Users/tms08012/Documents/2012FallJars/org.eclipse.ui.workbench_3.6.0.I20100603-1100.jar"/>
<classpathentry kind="lib" path="C:/Users/tms08012/Documents/2012FallJars/eclipse-workbench-2.1.0.jar"/>
<classpathentry kind="lib" path="C:/Users/tms08012/Documents/2012FallJars/aspectjtools-1.6.6.jar"/>
<classpathentry kind="lib" path="C:/Users/tms08012/Documents/2012FallJars/org.eclipse.ui.ide_3.5.1.M20090826-0800.jar"/>
<classpathentry kind="lib" path="C:/Users/tms08012/Documents/2012FallJars/swt-win32-3.0m8.jar"/>
<classpathentry kind="lib" path="C:/Users/tms08012/Documents/2012FallJars/org.eclipse.core.commands_3.6.0.I20110111-0800.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions VioletProductEclipsePlugin/VioletProduct.eclipse-plugin/.project
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>VioletProduct.eclipse-plugin</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/com.horstmann.violet-2.0.0-SNAPSHOT.jar" sourcepath="/VioletFramework"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>VioletProduct.eclipse-plugin</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,12 @@
#Sat Mar 19 01:56:39 CET 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
@@ -0,0 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
build.properties,\
lib/
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>

<extension
point="org.eclipse.ui.editors">
<editor
class="com.horstmann.violet.eclipseplugin.editors.VioletUMLEditor"
extensions="violet"
icon="META-INF/eclipse_plugin_icon.png"
id="com.horstmann.violet.eclipseplugin.editors.VioletUMLEditor"
name="Violet UML Editor">
</editor>
</extension>
<extension
point="org.eclipse.ui.newWizards">
<category
id="com.horstmann.violet.eclipseplugin"
name="Violet UML Editor"/>
<wizard
category="com.horstmann.violet.eclipseplugin"
class="com.horstmann.violet.eclipseplugin.wizards.NewUseCaseDiagramWizard"
icon="META-INF/eclipse_plugin_icon.png"
id="com.horstmann.violet.eclipseplugin.wizards.NewUseCaseDiagramWizard"
name="Use Case Diagram"/>
<wizard
category="com.horstmann.violet.eclipseplugin"
class="com.horstmann.violet.eclipseplugin.wizards.NewClassDiagramWizard"
icon="META-INF/eclipse_plugin_icon.png"
id="com.horstmann.violet.eclipseplugin.wizards.NewClassDiagramWizard"
name="Class Diagram"/>
<wizard
category="com.horstmann.violet.eclipseplugin"
class="com.horstmann.violet.eclipseplugin.wizards.NewObjectDiagramWizard"
icon="META-INF/eclipse_plugin_icon.png"
id="com.horstmann.violet.eclipseplugin.wizards.NewObjectDiagramWizard"
name="Object Diagram"/>
<wizard
category="com.horstmann.violet.eclipseplugin"
class="com.horstmann.violet.eclipseplugin.wizards.NewStateDiagramWizard"
icon="META-INF/eclipse_plugin_icon.png"
id="com.horstmann.violet.eclipseplugin.wizards.NewStateDiagramWizard"
name="State Diagram"/>
<wizard
category="com.horstmann.violet.eclipseplugin"
class="com.horstmann.violet.eclipseplugin.wizards.NewActivityDiagramWizard"
icon="META-INF/eclipse_plugin_icon.png"
id="com.horstmann.violet.eclipseplugin.wizards.NewActivityDiagramWizard"
name="Activity Diagram"/>
<wizard
category="com.horstmann.violet.eclipseplugin"
class="com.horstmann.violet.eclipseplugin.wizards.NewSequenceDiagramWizard"
icon="META-INF/eclipse_plugin_icon.png"
id="com.horstmann.violet.eclipseplugin.wizards.NewSequenceDiagramWizard"
name="Sequence Diagram"/>
</extension>

</plugin>
@@ -0,0 +1,138 @@
/*
Violet - A program for editing UML diagrams.
Copyright (C) 2007 Cay S. Horstmann (http://horstmann.com)
Alexandre de Pellegrin (http://alexdp.free.fr);
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

package com.horstmann.violet.eclipseplugin;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

import com.horstmann.violet.eclipseplugin.editors.EclipseDialogFactory;
import com.horstmann.violet.eclipseplugin.file.EclipseFileChooserService;
import com.horstmann.violet.framework.dialog.DialogFactory;
import com.horstmann.violet.framework.dialog.DialogFactoryMode;
import com.horstmann.violet.framework.file.chooser.IFileChooserService;
import com.horstmann.violet.framework.file.persistence.IFilePersistenceService;
import com.horstmann.violet.framework.file.persistence.StandardJavaFilePersistenceService;
import com.horstmann.violet.framework.injection.bean.ManiocFramework.BeanFactory;
import com.horstmann.violet.framework.injection.bean.ManiocFramework.BeanInjector;
import com.horstmann.violet.framework.injection.bean.ManiocFramework.InjectedBean;
import com.horstmann.violet.framework.plugin.PluginLoader;
import com.horstmann.violet.framework.theme.ITheme;
import com.horstmann.violet.framework.theme.ThemeManager;
import com.horstmann.violet.framework.userpreferences.DefaultUserPreferencesDao;
import com.horstmann.violet.framework.userpreferences.IUserPreferencesDao;

/**
* The main plugin class to be used in the desktop. This plugin embeds Violet in Eclipse
*
* @author Alexandre de Pellegrin
*/
public class VioletPlugin extends AbstractUIPlugin
{

// The shared instance.
private static VioletPlugin plugin;

@InjectedBean
private PluginLoader pluginLoader;

/**
* The constructor.
*/
public VioletPlugin()
{
plugin = this;
}

/**
* This method is called upon plug-in activation
*/
public void start(BundleContext context) throws Exception
{
super.start(context);
initBeanFactory();
BeanInjector.getInjector().inject(this);
EclipseDialogFactory.init();
installPlugins();
}

private void initBeanFactory() {
IUserPreferencesDao userPreferencesDao = new DefaultUserPreferencesDao();
BeanFactory.getFactory().register(IUserPreferencesDao.class, userPreferencesDao);

ThemeManager themeManager = new ThemeManager();
List<ITheme> themeList = new ArrayList<ITheme>();
themeManager.setInstalledThemes(themeList);
BeanFactory.getFactory().register(ThemeManager.class, themeManager);

IFilePersistenceService filePersistenceService = new StandardJavaFilePersistenceService();
BeanFactory.getFactory().register(IFilePersistenceService.class, filePersistenceService);

DialogFactory dialogFactory = new DialogFactory(DialogFactoryMode.DELEGATED);
BeanFactory.getFactory().register(DialogFactory.class, dialogFactory);

IFileChooserService fileChooserService = new EclipseFileChooserService();
BeanFactory.getFactory().register(IFileChooserService.class, fileChooserService);
}

/**
* This method is called when the plug-in is stopped
*/
public void stop(BundleContext context) throws Exception
{
super.stop(context);
plugin = null;
}

/**
* Returns the shared instance.
*/
public static VioletPlugin getDefault()
{
return plugin;
}

/**
* Returns an image descriptor for the image file at the given plug-in relative path.
*
* @param path the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path)
{
return AbstractUIPlugin.imageDescriptorFromPlugin("VioletPlugin", path);
}

/**
* Install plugins
*/
private void installPlugins()
{

this.pluginLoader.installPlugins();
}


}
@@ -0,0 +1,99 @@
/*
Violet - A program for editing UML diagrams.
Copyright (C) 2007 Cay S. Horstmann (http://horstmann.com)
Alexandre de Pellegrin (http://alexdp.free.fr);
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

package com.horstmann.violet.eclipseplugin.actions;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;

import com.horstmann.violet.eclipseplugin.editors.VioletUMLEditor;
import com.horstmann.violet.eclipseplugin.tools.DiagramPrinter;
import com.horstmann.violet.workspace.IWorkspace;

/**
* Eclipse plugin print action
*
* @author Alexandre de Pellegrin
*
*/
public class PrintAction implements IEditorActionDelegate
{

/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface .action.IAction, org.eclipse.ui.IEditorPart)
*/
public void setActiveEditor(IAction action, IEditorPart targetEditor)
{
this.setActiveEditor((VioletUMLEditor) targetEditor);
}

/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run(IAction action)
{
IWorkspace workspace = this.getActiveEditor().getUMLDiagramPanel();
Shell shell = this.getActiveEditor().getSite().getShell();
DiagramPrinter printer = new DiagramPrinter(workspace, shell);
printer.print();
}

/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action .IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IAction action, ISelection selection)
{
// TODO Auto-generated method stub
}

/**
* @return editor instance
*/
private VioletUMLEditor getActiveEditor()
{
return activeEditor;
}

/**
* Sets editor instance
*
* @param activeEditor
*/
private void setActiveEditor(VioletUMLEditor activeEditor)
{
this.activeEditor = activeEditor;
}

/**
* Editor instance
*/
private VioletUMLEditor activeEditor;

}

0 comments on commit 0c7e01c

Please sign in to comment.