Plugin: vorhandene EditorParts einbinden

Status
Nicht offen für weitere Antworten.
G

Guest

Gast
Hallo zusammen,
in meinem Editor (erbt von EditorPart) muss ich mehrere Modelle gleichen Typs darstellen. Für diese Modellart existiert bereits ein Editor (erbt auch von der Klasse EditorPart).
Ist es möglich mehrere dieser bereits existierenden Editoren in meinem Editor anzuzeigen? Am besten wäre es, wenn jeder EditorPart auf einer Section angezeigt werden würde.

Es geht mir hier nur darum, ob mein Vorhaben überhaupt möglich ist, da ich beim bisherigen googeln nicht wirklich weiter gekommen bin.
 

Wildcard

Top Contributor
Grundsätzlich wohl mit
Code:
IWorkbenchpart#createPartControl(Compoiste parent)
Ob alle Editoren damit klar kommen ist wieder eine andere Frage.
 
G

Guest

Gast
Hallo nochmal,

erstmal danke für die Antwort. Ist es denn überhaupt üblich so etwas zu tun, also bereits vorhandene Editoren einzubinden? Oder macht man sowas eigentlich nicht?

Ich hab das nun mal versucht. Es werden zwar keine Fehler ausgegeben, allerdings haben die Sections keinen Inhalt.
Evtl ist ja gleich auf den ersten Blick ein Fehler zu sehen?!

Code:
@Override
	public void createPartControl(Composite parent) {
		FormToolkit toolkit = new FormToolkit(parent.getDisplay());
		ScrolledForm form = toolkit.createScrolledForm(parent);
		Composite body = form.getBody();
		GridLayout gridLayout = new GridLayout();
		gridLayout.makeColumnsEqualWidth = false;
		gridLayout.numColumns = 3;
		body.setLayout(gridLayout);
		IWorkbench workbench = PlatformUI.getWorkbench();
		IProject project = emsFile.getProject();
		for (MyModel modelInstance : anotherModel.getList()){
			try {
				String tmsFilePath = createPath(emsFile.getLocation(), tmsInstance);
				IFile tmsFile = project.getFile(tmsFilePath);
				Section section = toolkit.createSection(body, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
				section.setText(modelInstance.getName());
				SimulationEditor editor = new SimulationEditor(); //der vorhandene Editor
				editor.init(this.getEditorSite(), new FileEditorInput(tmsFile));
				editor.createPartControl(section);
				section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
			} catch (PartInitException e) {
				e.printStackTrace();
			}
		}
	}
 

Wildcard

Top Contributor
Anonymous hat gesagt.:
Ist es denn überhaupt üblich so etwas zu tun, also bereits vorhandene Editoren einzubinden? Oder macht man sowas eigentlich nicht?
Ich hab das bisher nur bei VE gesehen und dort würde ich auch mal schauen (der Java Editor wird in die Visual Class eingebunden).
Die Error Log zeigt auch keine Fehler an? Was spuckt dir der Debugger über die EditorParts aus?
Liegt SimulationEditor im Quellcode vor, so das du mal nachsehen kannst was da passiert bzw. nicht passiert?
 
G

Guest

Gast
Hallo,
der SimulationEditor liegt im Quellcode vor und ich habe nun auch schon eine ganze Weile debuggt. Es treten keine Fehler auf.
Beim VE hab ich jetzt noch nicht reingeguckt, aber müsste ich nicht noch der Section mitteilen, dass die Instanz vom SimulationEditor der Client der Section ist?
Wenn man einen Viewer auf der Section platziert muss man ja auch Section#setClient(Control control) aufrufen. Etwas in dieser Art müsste ich doch sicher auch für den EditorPart machen oder?
Vielleicht liegt da ja der Fehler, nur habe ich keine Methode gefunden um den EditorPart als Client zu setzen.
 

Wildcard

Top Contributor
Hol dir die Children der Section, dann hast du dein Control...
Es ist übrigens immer besser im Kleinen zu testen, d.h. ohne Section, nur mit Composite.
 
G

Guest

Gast
Hallo,
die Hoffnung den fertigen Editor einbinden zu können habe ich nun aufgegeben. Ich versuche nun meine Models in TreeViewern darzustellen. Dabei sollen die Views unabhängig voneinander auf SelectionEvents reagieren können, d.h. jeder View reagiert/ändert seinen Zustand wenn ein Element aus ihm selbst angeklickt wurde.
Allerdings läuft das noch nicht wie gewünscht :cry:

Code:
public class MyEditor extends EditorPart implements ISelectionListener {
private RunTaskAction runtaskaction;
...

@Override
   public void createPartControl(Composite parent) {
      FormToolkit toolkit = new FormToolkit(parent.getDisplay());
      ScrolledForm form = toolkit.createScrolledForm(parent);
      Composite body = form.getBody();
      GridLayout gridLayout = new GridLayout();
      gridLayout.makeColumnsEqualWidth = false;
      gridLayout.numColumns = 3;
      body.setLayout(gridLayout);
      for (MyModel modelInstance : anotherModel.getList()){
         try {
            EditPartFactory editpartfactory = new TaskModelSimulationEditPartFactory();
				Section section = toolkit.createSection(body, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
				section.setText(tmsInstance.getName());
				TreeViewer treeViewer = new TreeViewer();
				treeViewer.createControl(section);
				DefaultEditDomain editDomain = new DefaultEditDomain(this);
				editDomain.addViewer(treeViewer);
				treeViewer.setEditPartFactory(editpartfactory);
				getSite().setSelectionProvider(treeViewer); //hier muss irgendetwas anderes passieren
				treeViewer.setContents(modelInstance.getSimulation().get(0));
				section.setClient(treeViewer.getControl());
				section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
				editDomain.setActiveTool(new RunTaskTool(runtaskaction));
         } catch (PartInitException e) {
            e.printStackTrace();
         }
      }
   }

public void selectionChanged(IWorkbenchPart part, ISelection selection) {
        if (this.equals(getSite().getPage().getActiveEditor())) {
    		runtaskaction.update();
        }
	}

@Override
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
		if (!(input instanceof IFileEditorInput)){
			throw new PartInitException("Input must be from type IFileEditorInput");
		}
		simulation = createEnsembleModelSimulation(((IFileEditorInput) input).getFile());
		setSite(site);
		setInput(input);
		updateTitle();
		createActions();
		getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this);
	}

Hier wird nun der TreeViewer erstellt. Als Tool wird ein RunTaskTool übergeben, welches z.B. auf einen Doppelklick reagiert. Allerdings funktioniert dies nur für den zuletzt erstellten TreeViewer, was auch logisch ist, weil er ja als SelectionProvider angemeldet ist. Alle anderen TreeViewer reagieren nicht auf Events.
Gibt es eine Möglichkeit, das jeder Viewer auf seine eigenen Events reagiert und nicht nur der zuletzt erstellte Viewer? Ich habe bereits überlegt einen eigenen SelectionProvider zu schreiben, der alle TreeViewer verwaltet und dann dem selektierten Viewer die Selection übergibt. Könnte das klappen und wenn ja wie müsste das ungefähr aussehen?

Ich hoffe es ist ungefähr klar geworden, was ich möchte :bahnhof:

Schon mal danke und schönen Gruß!!
 
Status
Nicht offen für weitere Antworten.
Ähnliche Java Themen
  Titel Forum Antworten Datum
M import org.bukkit.plugin.java.JavaPlugin; funktioniert nicht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 17
P Cucumber Plugin Installation . Eclipse Warnmeldung IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
W NetBeans Eigenes Plugin - Eintrag in verschiedene Kontextmenüs IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
J Netbeans - WakaTime - Plugin sendet keine Daten IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
Flocreper Could not load plugin Fehler IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
C Eclipse Plugin ClassLoader IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
ruutaiokwu Eclipse Eclipse-Plugin für UML "Reverse Engineering", um aus Code Klassendiagramme zu erstellen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
U Ich kann ein Plugin anhand von Maven nicht builden IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 14
K easy UML Plugin Netbeans 8.1 IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
A Eclipse Eclipse mit eigenem Plugin braucht für ersten Start sehr lange IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
U NetBeans plugin oder Programm für Codeschnippsel gesucht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 25
D Eclipse JavaFX Plugin funktioniert nicht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
A Eclipse Eclipse Mars Plugin Jar Dateien IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
D Eclipse Plugin: requires 'bundle org.junit4 4.5.0' IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
X Plugin lässt sich nicht einbinden.. IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
T Anfänger: UML-Plugin für Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
M JavaFX-Plugin für Eclipse Juno IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
Z Eclipse Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
E mysql-connector für Eclipse DB plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
A Leere Methoden o.ä. finden? Eclipse Plugin? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
M Eclipse Webstart plugin einbinden IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
G Eclipse Eclipse Plugin für Debian Paket Erstellung (DEB)? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
D NetBeans UML-Plugin sehr langsam IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
R Eclipse Eclipse Sql Formater Plugin? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
W Plugin für Quellcode -> UML ? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
D PlugIn-Wrapper für Log4J IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
firefexx Eclipse UML Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
S NetBeans SQE-Plugin (Software Quality Environment) IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
D Eclipse Plugin Entwicklung, aber wie beginnen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
A Fehler mit Eclipse Android Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
Sonecc Eclipse Plugin beim Starten laden IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 10
H maven-javadoc-plugin: package does not exist IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
B Eclipse Debugger Plugin "Visual Studio Style" IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
M Eclipse GUI PlugIN IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 11
algorismi Eclipse UML Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
T UML Plugin/Tool IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
D Eclipse Package in von Plugin erstellen lassen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
L Eclipse Plugin für HTML? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
K Eclipse Editor: Formatierung - Plugin für umfangreichere Optionen? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
C Eclipse Plugin VE IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
Y Eclipse Tomcat Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
S Eclipse Eclipse Themes und Scala Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
O Eclipse Probleme bei der PlugIn-Installation IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
T Eclipse Maven-Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
O TPTP-Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
nrg Eclipse Mercurial Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
T Eclipse Plugin Package IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
S Problem mit javacc-Plugin für Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 8
H Empfehlung Eclipse Plugin: Reverse Engineering IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
A Eclipse-Plugin für eigenes Code-Folding IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
Houly GUI-Builder Plugin für Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
T Eclipse Plugin Richfaces / JSF IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
M Grails Plugin in IntelliJ IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
S PASCAL-Plugin für Netbeans/Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
byte Maven2 und TestNG Eclipse Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
X Eclipse Update Site für Intranet mit Buckminster Plugin nicht vollständig IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
byte Tipp: Eclipse Builder Pattern Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
P Javadoc - Autofinder Plugin für Location Path IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 24
W Eclipse Bug-Tracking Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
Ark Eclipse-Plugin gesucht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 13
Kasu Eclipse: Plugin, das Konsolenausgabe automatisch mitloggt? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
S SVN-Plugin für Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
padde479 Oracle Plugin Ecplise IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
X Eclipse Subversion Plugin Subversive <=> Subclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
X Eclipse UpdateSite-neue Plugin Version wird nicht angezeigt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
GilbertGrape Eclipse Plugin FindBugs IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
V Plugin für Lines of Code (loc)? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
G Eclipse Plugin's Liste IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
F Maven plugin für Eclipse: tld dependencies in jars IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
S Eclipse FindBugs Plugin - wie mache ich das? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
G Plugin i18nedit öffnet Datei nicht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
R vernünftiges ftp plugin für eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
reibi Eclipse PlugIn Apache Studio als download IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
Antoras Eclipse Plugin für grafische Oberflächen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
T XML Plugin für Eclipse Ganymede IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
N Eclipse Plugin für XML / XSL Transformation gesucht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
G Gui-Builder-Plugin für Eclipse ? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
Y Eclipse Plugin für Coverage IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
R Eclipse - LISP plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
S Wokflows modellieren Tool / Eclipse-Plugin gesucht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
M Eclipse-Plugin: Fehlende Abhängigkeit? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
Y myEclipse 6.0.1 - SVN Plugin wie installieren IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
M Eclipse-Plugin: Properties-File IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
ARadauer eclipse plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
S jEdit - Plugin JCompiler funktioniert nicht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
M Probleme mit JSF-Plugin bei Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
padde479 Externes Plugin-Verzeichnis Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
S Eclipse GCJ Builder Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 13
K eclipse plugin für oberflächen programierung? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
padde479 VSS Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
T Eclipse Plugin manuell installieren IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
K Eclipse Plugin aktivieren IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
I Sysdeo-Plugin für Eclipse / Tomcat - wo downloaden? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 11
G eclpse plugin views beim start offen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
G lejos plugin installation@eclipse? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
S XML Editor Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
padde479 PL/SQL Plugin für Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
padde479 Plugin für PL/SQL IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
W Eclipse und Geronimo Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
B Eclipse will Sysdeo-Plugin nicht erkennen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4

Ähnliche Java Themen

Neue Themen


Oben