Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » I don't find the solution
I don't find the solution [message #384285] Tue, 14 April 2009 14:07 Go to next message
basem-ca is currently offline basem-ca
Messages: 14
Registered: July 2009
Junior Member
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
Re: I don't find the solution [message #384286 is a reply to message #384285] Tue, 14 April 2009 14:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
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.
Re: I don't find the solution [message #384287 is a reply to message #384286] Tue, 14 April 2009 14:32 Go to previous messageGo to next message
basem-ca is currently offline basem-ca
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 #384397 is a reply to message #384287] Tue, 14 April 2009 14:50 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26141
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 ?
>
>
>
Re: I don't find the solution [message #615329 is a reply to message #384285] Tue, 14 April 2009 14:18 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26141
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.
Re: I don't find the solution [message #615331 is a reply to message #384286] Tue, 14 April 2009 14:32 Go to previous message
basem-ca is currently offline basem-ca
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 #615704 is a reply to message #384287] Tue, 14 April 2009 14:50 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26141
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 ?
>
>
>
Previous Topic:I don't find the solution
Next Topic:[PMF] Business modeling
Goto Forum:
  


Current Time: Sat Oct 25 03:42:22 GMT 2014

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

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