Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Re: I don't find the solution
Re: I don't find the solution [message #225939] Tue, 14 April 2009 14:18 Go to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080406060502040708050201
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Please use the GMF newsgroup for questions about GMF. I've added it to
the "to" list of the reply, so no need to repost. Here's how EMF's
generated wizard opens the editor upon completion.

public boolean performFinish() {
try {
// Remember the file.
//
final IFile modelFile = getModelFile();

// Do the work within an operation.
//
WorkspaceModifyOperation operation =
new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor
progressMonitor) {
try {
// Create a resource set
//
ResourceSet resourceSet = new
ResourceSetImpl();

// Get the URI of the model file.
//
URI fileURI =
URI.createPlatformResourceURI(modelFile.getFullPath().toStri ng(), true);

// Create a resource for this file.
//
Resource resource =
resourceSet.createResource(fileURI);

// Add the initial model object to the
contents.
//
EObject rootObject = createInitialModel();
if (rootObject != null) {
resource.getContents().add(rootObject);
}

// Save the contents of the resource to
the file system.
//
Map<Object, Object> options = new
HashMap<Object, Object>();
options.put(XMLResource.OPTION_ENCODING,
initialObjectCreationPage.getEncoding());
resource.save(options);
}
catch (Exception exception) {

CustOrderEditorPlugin.INSTANCE.log(exception);
}
finally {
progressMonitor.done();
}
}
};

getContainer().run(false, false, operation);

// Select the new file resource in the current view.
//
IWorkbenchWindow workbenchWindow =
workbench.getActiveWorkbenchWindow();
IWorkbenchPage page = workbenchWindow.getActivePage();
final IWorkbenchPart activePart = page.getActivePart();
if (activePart instanceof ISetSelectionTarget) {
final ISelection targetSelection = new
StructuredSelection(modelFile);
getShell().getDisplay().asyncExec
(new Runnable() {
public void run() {

((ISetSelectionTarget)activePart).selectReveal(targetSelecti on);
}
});
}

// Open an editor on the new file.
//
try {
page.openEditor
(new FileEditorInput(modelFile),

workbench.getEditorRegistry().getDefaultEditor(modelFile.get FullPath().toString()).getId());
}
catch (PartInitException exception) {
MessageDialog.openError(workbenchWindow.getShell(),
CustOrderEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label "),
exception.getMessage());
return false;
}

return true;
}
catch (Exception exception) {
CustOrderEditorPlugin.INSTANCE.log(exception);
return false;
}
}

bassem-ca wrote:
> In the method actionPerformed of a button ,how can I invoke my
> plugin (4 files jar) which is a graphical editor developped with GMF ?
>
> Thanks
>

--------------080406060502040708050201
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Please use the GMF newsgroup for questions about GMF.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: I don't find the solution [message #225945 is a reply to message #225939] Tue, 14 April 2009 14:32 Go to previous messageGo to next message
basem-ca is currently offline basem-caFriend
Messages: 14
Registered: July 2009
Junior Member
thanks

Can I applicate this code in a one external java file in another IDE like
JCreator ?
Re: I don't find the solution [message #225962 is a reply to message #225945] Tue, 14 April 2009 14:50 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
I don't think so. I'm not sure how to make an Eclipse do something from
another process. That's not even a GMF question...

basem-ca wrote:
> thanks
>
> Can I applicate this code in a one external java file in another IDE
> like JCreator ?
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Link Constraint in Java Example
Next Topic:Polygon and ScalablePolygon
Goto Forum:
  


Current Time: Thu Apr 25 20:27:14 GMT 2024

Powered by FUDForum. Page generated in 0.02678 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top